Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

982 profile views

mjut's Achievements

Jr. Member

Jr. Member (3/6)



  1. I just used this today – very handy. I specified a template too: wire()->addHookBefore('Page::addable', null, function ($e) { if ($e->object->parents("template=basic-page")->count > 1) $e->object->template->noChildren = 1; });
  2. @Zeka Thank you tons! Yet again, it amazes me how simple Processwire is. I went for the owner selector. Sorry, I did not know about this. The functional code looks like this: <ul> <?php $tags = $pages->find("template=tag, tags.owner.template=post, sort=title"); foreach ($tags as $tag) { ?> <li><a href="<?php echo $tag->url ?>"><?php echo $tag->title ?></a></li> <?php } ?> </ul> As simple as that. I looked it up in the docs, but did not find it – but there is a blog post about Owner Selectors: https://processwire.com/blog/posts/processwire-3.0.95-core-updates/
  3. I am building a web site with a blog / posts section. With each post I create I can add tags. That is happening with a page reference field. For each new tag a new tag (page) will be created. On an "archive" page, I want to list all tags with this code: <ul> <?php $tags = $pages->find("template=tag, sort=title"); foreach ($tags as $tag) { ?> <li><a href="<?php echo $tag->url ?>"><?php echo $tag->title ?></a></li> <?php } ?> </ul> Simple as that, it works as expected. All tags used anywhere in my posts are listed. (yaaay!) But: When creating a new post without publishing, new tags be created and will listed on my archives pages. How can I modify my code to exclude all tags that are associated with unpublished posts? Cheers Stephan
  4. Oh, I wasnt aware, that there's a module. I am sure, this will lead me to a solution. Thanks a lot, this is very helpful!
  5. @dragan thank you for answering! I 100% agree with everything you wrote. (including the multiple posting. that was due to me searching the forum and collectiong information). Usually, I don't need a differnt way of handling a multi-lang site. The processwire way just works and is fine and is straight forward for me. This project I am working on is different. Processwire is providing and delivering the content. But there wont be any UX and no navigation. We will have lots of texts in the museum, each text is accompanied by a QR-Code for the translation into 2–3 languages. (so, QR-Codes all over the museum) The visitors need to scan a QR-Code to get to the specific page containing the translation. To clarify this procedure, I can think of two versions to achieve this. The first one is the usual processwire-way (like in the provided multi-lang-profile). The second one is my desired one, that I need help with. 1. simple solution for each language, there will be one QR-Code (each text in the musuem is accompanied with multiple QR-Codes to choose from) the Visitor scans one of them and the language specific url will be opened conclusion: Each text needs more QR-Codes … one for each language. Thats ugly, and if there will be more language later on, I’d need to add even more QR-Codes… 2. wanted solution there will be only one QR-Code to scan for the visitors, no matter what language - thats much nicer than several QR-Codes the visitor scans that one QR-Code, and will be send to the default language. there will be a lnaguage-switch. So, the visitor can set the desired language. the visitor scans the QR-Code for the next text, the visitor will be directed to the previously set language. (without need to set the language switch again) - if there will be the need to add more languages later on, I can add these in processwire without managing more QR-Codes I hope, this explains the whole project… 😉 @dragan I like both of your suggestions – the detection of the browsers language and the cookie storage. I did look into the API to set a cookie (session storage?) but I did not understand the techniques described there. No luck for me there… I am going to look into the browser-language detection now. Cheers Stephan
  6. I think, I have the similar question: I need the language-settings being stored into the (guest-)users session. The reason is, the URLs will be openend via an QR-Code. I want the same QR-Codes leading to the (previewsly) selected language by the user. Simply put: 1. the user openes one page via QR-Code. The language can be switched to the desired language. 2. whenever the user openes another page via a different QR-Code, I want processwire to remember the language settings. (depended on each user) does this make any sense? or should i explain that in detail? I already did create a question over here: https://processwire.com/talk/topic/23299-one-url-for-multiple-languages/ Thanks for your help!!!! Cheers Stephan
  7. Hi forum, I have got a question for a multi-language page: English and Danish. I want to give away URLs, no matter if the users language is. www.url.com/en/title1 (default language) www.url.com/dk/title1 If I type www.url.com/title1 the page is being redirected to the default language – even if I previously did chose Danish as my language. Is it possible, that the users prefered language is the redirct? Say, if I choose to view the page in Danish and type www.url.com/title1 I want the redirect to www.url.com/dk/title1 not to the default language. Thanks for suggestions and help Stephan
  8. What do you think of this: https://perishablepress.com/7g-firewall/ ? As I do not know a lot about server configurations, this seems like a hassle-free way to put some layer of security to my websites. What I get from it, I just have to copy these lines provided to my .htaccess file. Edit: It seems to work with my processwire installation: i got the first entry written into the log. (my site got crawled by 360Spider ???)
  9. @Sergio Wow. This is working. I am no php expert. I am always having trouble on this... But I am on my way to get more comfortable on working with variables.... Thanks a lot! <?php $p = $pages->get(1241); if (!$p->isUnpublished()) : ?> <a href="<?php echo $p->url() ?>"><?php echo $p->title() ?></a> <?php endif; ?> yup - tested! The short version works 100%!
  10. Hello, I am having trouble achieving this: I am trying to place a link to a specific page in my template. But I want this link displayed only, if the page is published. With this code, its not working: <?php if ($pages->find("id=1241, status=published")) { ?> <a href="<?php echo $pages->get(1241)->url() ?>"><?php echo $pages->get(1241)->title() ?></a> <?php } ?> (The link is being displayed no matter the status of the page "1241") How can I fix this? Thanks for your help!!!
  11. Thank you for the input! @AndZyk that module is amazing. I fiddled around with it for a bit - the number of tweaks is unlimited! I have to save this for other projects. It seems a bit of an overkill for my needs now. The other approach is exactly what i was looking for! Thank you tons @kongondo - this works like a charm. Cheers Stephan
  12. Hello! I am trying to get some extra css-file into my admin templates. I managed to modify my admin.php to this: <?php namespace ProcessWire; require($config->paths->adminTemplates . 'controller.php'); echo "<link rel='stylesheet' type='text/css' href='" . $config->urls->templates . "css/admin.css'>"; By doing so, the css <link> is added to the very end of each parsed admin-html. (right AFTER the closing </body> tag.) That causes some trouble. e.g. the page tree is not displaying any more. Although, other pages are working - like the edit form of a page. My question: is there a correct way of adding my extra css to the admin area? Thanks for you help! Stephan
  13. Ah. I see. That seems pretty easy to put into a template-file. I just add the js/css libraries to the template.php. The tricky part would be to get it working with actual file uploads to processwire, I assume.
  14. Thanks Ivan, Yes, I kind of expected this. I feel stupid for asking that question. (Especially, as there are so many posts regarding front-end forms.) But good to know about this. If there were a simple solution I would have been happy that I posted this question! Thanks again! Steph
  15. Hello Forum, I am relatively new to processwire and have been playing around with some simple websites so far with it. I love the simplicity and the straight forward approach to it. I felt "at home" right away! =D The only thing, I just can not get done is implementing a simple post-form in a template. (front-end) I want to get registered users to create content via a simple form. Yes, there are several tutorials in this forum. BUT: I want the file upload to look like the upload in the back-end: - multiple upload - rearrange order of files Is that hard to build? It should be "there"... or do i need to install a module like https://processwire.com/talk/topic/12050-module-jquery-file-upload/ I would like to build it with core functionality. What do you guys think? Can you point me into the right direction? Cheers Stephan
  • Create New...