Jump to content

marcus

Members
  • Posts

    289
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by marcus

  1. A) {$pages->find("template=child-template, provincie=$child->provincie")} could result in multiple pages. It's not clear whether you're doing this already, but you'll have to iterate through the results like

    $children_provincie = $pages->find("..."); // Replace ... with your selector
    
    foreach ($children_provincie as $c) {
        echo $c->url;
    }
    

    ...and so on.

    B) Even if the selector would return just a single result, you have to return ->url to get it working as a link. Thats because, in your second snippet, you just get an ID instead of a path to the page being found.

  2. Hi felix, thanks for the updates on the issue! I haven't found time in the last days to move any further in this project - which is just a learning installation anyway - but will look into TemplateTwigReplace on the weekend. I better be learning twig sooner or later, if not for PW then for Drupal 8 ;)

    • The testing environment is an out-of-the-box MAMP 3 virtual host, meaning PHP 5.5.10 - but I could try to downgrade, since it will really take some time until this version hits my customers web hosters ;)
    • Just MarkupSimpleNavigation, ManageFiles, FieldtypeCropImage -  just installed, none of them initiated in any form - apart from that the installation is totally empty / unconfigured
    • Yeah, different variable name, integer instead of string, but same effect

    edit: 5.4.25, 5.3.28 - no difference

  3. Hi Felix,

    greetings to Hannover and thanks for your answer. die(test) works and proves the dataprovider is loaded at all. But the value of $foo still isn't provided to home. See my code below in both files:

    home.php: 

    <?php 
    
    /**
     * Home template
     *
     */
    
    echo "This should be the value of foo: " . $foo;
    

    HomePage.php:

    <?php
    
    class HomePage extends \nw\DataProviders\PageDataProvider {
    
    	public function populate() {
    
    		$this->foo = 'bar';
    		$this->page->foo = 'baz';
    		//die('test');
    	} 
    }
    
    

    But the output is just "This should be the value of foo:", without any 'bar' added.

    Overall, its just testing a different way to populate/architect my templates, so no show stopper at all - but thanks for the offer via Skype!

    Marcus

  4. Hi marco,

    unfortunately the example for a home page template, mentioned above, doesn't work in my case.

    I installed the module, left the default setting dataproviders, created this very folder in site/templates/ (checked its permissions), placed a HomePage.php with your example code in it, opened home.php and tried to echo $foo. With no result. Am I misunderstanding the concept, or did I forget a neccessary step to make this work?

    Thanks in advance!

    marcus

    PS: PW 2.4, Module version 1.0.2

    • Like 1
  5. My development workflow / deployment process is git- and beastalkapp-based, and heavily inspired by this video by Chris Coyer from css-tricks.com: http://css-tricks.com/video-screencasts/109-getting-off-ftp-and-onto-git-deployment-with-beanstalk/

    Meaning:

    • Working locally
    • but having a staging server, more or less like the one einsteinsboi has described above
    • and having a production server, the clients webspace

    Beanstalk handles the deployments which tend to be automatically on staging (just the master branch) and - always - manually on production.

    • Like 2
  6. Launched just a few days ago: http://yummimami.de - a presentational website for a German startup supplying healthy and kid-compatible presented food to schools.

    Some features

    • Responsive
    • Forms via FormBuilder
    • Navigation via MarkupSimpleNavigation (which, at least in my use case, evolves into something super essential for PW - like Views for Drupal for example ;) )
    • Widget handling via having a big pool with pages of template type "widget", then referencing (and hence, rendering) them on content pages
    • Editorial influence on the homepage teasers main color via SVG + field + ColorPicker (not necessary to that extent since the customer doesn't need to change the color to any other that magenta, green or brown - but still: proof of concept)
    • Like 13
  7. Hi there,

    in need for a light knowledge base software and not happy with solutions such as MediaWiki, Dokuwiki or Confluence I decided to try to build such a tool based on ProcessWire. At the moment this profile is lacking of features, but doing well in the context it is created for - a somewhat protected simple knowledge base for internal use. :)

    It has some basic features but I'm aware that there's still way to go. So if anyone is interested, please find the code attached here or on GitHub: https://github.com/marcus-herrmann/ProcessWire-KnowledgeBase-SiteProfile

    I exported the data from a PW 2.4 installation, but not have tested it yet against older versions.

    Installation

     
    Before running the installer of ProcessWire copy/replace 
    /site-default/install/
    /site-default/templates/
    /site-default/modules/
    with the folders from this zip.
     
     
    Constraints
     
    It's not possible to export user roles with ProcessWire's Site Export Module this profiles templates are checking just whether they are accessed by an anonymous or logged in user.
     
     
    Features
     
    • Tagging of wiki-articles
    • Set articles to globally sticky ( = for all users)
    • Personal bookmarking of articles for logged in users
    • When using markdown to author wiki-articles, code highlighting via highlightjs
     
    Included modules
     

    Hopefully this profile is useful for you in any way.

    Best,

    marcus

    Edit: Forgot GitHub link...

    post-912-0-37072900-1396112277_thumb.jpg

    post-912-0-08824200-1396112286_thumb.jpg

    post-912-0-75047700-1396112295_thumb.jpg

    ProcessWire-KnowledgeBase-SiteProfile-master.zip

    • Like 26
  8. Hi Soma,

    thanks for this approach! I was kind of thinking out loudly - I hope it wasn't understood as a feature request and totally can understand that you aren't looking forward to adding every special request into the module core. I'll try to implement a hook like this - thanks again for pushing me in the right direction!

    Best,

    m

  9. Hi :)

    and once again a newbee question from me... For some reason I am not able to make the following code work. It outputs the navigation not from page 1001 but from the real root, page 1. And I'm scratching my head asking why...

    <?php
    $teaser1 = $modules->get("MarkupSimpleNavigation");
    			$options = array(
    			    'levels' => false,
    			    'max_levels' => 1,
    			    'show_root' => false
    			);
    $rootTeaser1 = $page->get(1001);
    echo $teaser1->render($options, null, $rootTeaser1);
    ?>
    

    Can you help me finding out why it ignores my custom root? And yes, 1001 does exist and has non-hidden children nodes.

    Thanks in advance!

    Marcus

  10. Hi,

    sorry to bother you again -- I'll try not to open topics/asking questions daily ;) The following codes does not work properly and I'm wondering why:

    	<?php $download1 = $pages->get(1014)->download1;?>
    	<a href="<?= $download1->url?>">
    		<img src="<?php echo $config->urls->templates?>images/pdf.png" />
    	</a>	

    Ressource 1014 has the field "download1" filled with a dummy pdf, and the URL is printed. But nothing more, ->file, ->filename, ->name, ->ext and so on are empty although the file (dummy_1.pdf) can "physically" be found in /site/assets/files/1014/

    Have I missunderstood the Cheat sheet/API in some way?

    Thanks again! :)

    marcus

    Edit: this code is placed in another template, therefore the $pages->get(1014) instead of $page->download1

  11. Hi there,

    for some reason I do not succeed in doing a simple iteration (in this case with images):


    <?php 
     
    $number_of_images = count($pages->get(1012)->images);
     
     
        foreach($pages->get(1012)->images as $image) {
            $thumbnail = $image->size(118,112);
            echo "<a href='{$image->url}'><img class='photo' src='{$thumbnail->url}' alt='{$image->description}' /></a>";
        if ($number_of_images % 3 == 0) { echo "<p>Insert</p>";}
     
        }
     
    ?>
     
    In this case, there a 5 images attached to 1012, if I echo $number_of_images inside the foreach loop it prints "5". But on the other hand this variable doesn't react on my "$number_of_images % 3 == 0", meaning that it does not insert the <p>...-Chunk every 3 images.
     
    Can you help me to find the error in my approach or code? :)
     
    Thanks in advance!
    marcus 
×
×
  • Create New...