Jump to content

mjut

Members
  • Posts

    24
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by mjut

  1. Here is the script:

    #!/usr/bin/php
    <?php namespace ProcessWire;
    include("/home/stephan/www/index.php");
    foreach ($pages->find("template=post, status=unpublished, sort=unpublished, limit=1") as $post)  {
    		$post->removeStatus('unpublished');
    		$post->addStatus('published');
    		$post->save();
    	}

    With cron it is triggered once a day and it will look for unpublished posts. If there are any, the oldest post will get published.

    Simple as that.

     

    I am using this script to update my photo blog https://photos.stephansimonis.com more regularly. 😉

    • Like 3
  2. Hi forum,

    I don't really know how to do this: I want to create multiple (not published but saved) pages. From that on, I want the pages to be published each page a day aromatically.
    I am sure, this is possible.. But where do I begin?

    Thanks for suggestions and input.
    Cheers

    Stephan

     

     

  3. Alright. It wasn't a MySQL-issue at all! 

    In my search-template I've been using the selector fields incorrectly. I wanted a page-referenece field to be searched and listed. in the selectors I called "pagereference" what I need to do was putting "pagereference.title" into the selectors!

    Without putting *title after the field, the results were based on searching the url. That led to results I wasnt expecting... 

  4. I did revised and recoded my personal blog (journal). It is running with Processwire smoothly since years. A decade ago I started that journal using Textpattern.. So I thought, hey, why not putting it back to Textpattern? I still have a lot of sympathy to Textpattern. Probably because it is the system I learned on.. 

    After setting it all up – it made me giggle every time when I remembered how to do, and work around things – I was happy with the result. 

    After this little travel back in time, I deleted Textpattern again to keep on using Processwire. Nothing else to say. 

    Why am I posting this little story? I dont know... But this might be the right place where people understand what I am saying.. ;)

    Thanks a lot!

    • Like 9
  5. I am experiencing the same issue – changing the collation did not fix it. But maybe it is something different?

    When searching for Lüneburg the word is being found in all body-fields (textarea) but not in title-fields (the system generated text field).
    Replacing the Ü with U, I'll get the desired results

    Here comes the weird behavior: 
    When searching vor üneburg (umlaut it the beginning of the word) all results with "Lüneburg" in the title-field are being found and listed!!! Isnt that weird?
    I did look into the database: all tables are set to utf8_general_ci. Changing them to utf8_unicode_ci or even utf8mb4_unicode_ci did not change a thing. 

    I am not sure, where to look into next?  

  6. On 5/12/2017 at 3:23 AM, kixe said:

    put this in your ready.php

    wire()->addHookBefore('Page::addable', null, function ($e) {
       if ($e->object->parents->count > 1) $e->object->template->noChildren = 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;
    });

     

  7. @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/

  8. 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
     

     

     

  9. @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
  10. 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

     

  11. 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

  12. 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 ???)

  13. 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!!!

  14. 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

     

  15. 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

  16. 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...