Jump to content

Macrura

PW-Moderators
  • Posts

    2,756
  • Joined

  • Last visited

  • Days Won

    40

Posts posted by Macrura

  1. @kongondo thank you - i'll check those out

    @jsantari - something like this should work ;

    <?php
    
    $group = $page->widget_group; // widget group is a repeater
    
      foreach ($group as $item) { // each repeater item has 2 fields, one is a page select called widget_group_name ?>
         
         <ul>
         	<li><?php echo $item->widget_group_name->title; ?></li>
          	<li><?php echo $item->widget_group_name->block; ?></li>
         </ul>
    
    <?php } // end foreach ?>
    

    Also want to mention that the field names are not really optimal; for example the page select should probably be just widget

  2. @joe_g - you could use url segments to get the URLs to look real and have the tags.

    as far as the structure, looks like a page select to me, with possibly some custom validation, such as max 2 for the parents.

    field 1: page select, selects from pages with tag 'parent' (custom selector)

    field 2: page select, selects from pages with tag 'child'

    allow creation of new pages on that page select...

    not sure if this is what you're after though..

    right, ordering is tricky... but you could make a custom field for that too.. might need a custom module to handle global ordering by tag.

  3. easy solution - put all the pages where you want;

    use a custom menu no related to the page tree as explained here:

    http://processwire.com/talk/topic/2787-custom-menu-not-related-to-page-tree/

    then make a way to find content based on tags, using the template/api and selectors.

    you could make your category pages be search result pages, like with this at the end /?tags=

    and the actual pages themselves be like this at the end /?tag=

    use a redirect template for the pages, so no one ever sees the 'real' url

  4. @jmart - if there are not a lot of pages, don't nest the pages in the admin, but then make a custom menu.

    That's how it do it on 3 sites now. (in other words make all of the pages child of the root.)

    As far as making the custom menu, i do it the way discussed in this thread, and works perfectly. You have to adjust the code to your specific menu needs..

    http://processwire.com/talk/topic/2787-custom-menu-not-related-to-page-tree/

    i also wanted to mention that once you have a lot of pages in the admin, you could use Soma's datatable to look for pages, instead of the tree; then you could filter/sort by some criteria (title, template); so in this sense you would using PW as more of a bucket system... which for some projects is good, and PW handles it fine...

    • Like 2
  5. well i picked up the idea from Soma to always have a 'tools.inc' file in my template folder.

    Then in that file i paste in the code to run, load that page, and the commands execute. I'm keeping these various snippets in codebox snippets.

    I agree that this method seems a little arcane, but it works well; makes it very easy to manipulate your data...just have to be careful since you're mass editing..

    Back in my joomla days i used nonumber.nl DB replacer, which enabled you to do this kind of thing, and be able to preview the changes to the data, which was nice;

    this PW api technique is more powerful though; i make a lot of backups to my sites when i'm working on them, so in the event something goes awry i can revert..

    so to sum up - YES! it would be great to have this in the backend, and even be able to preview the changes.. if someone out there likes to write a module...i would support it in any way i could.

  6. know this is kind of obvious, but the last time i did that i just ran a replacement on the content with the api..

    <?php 
    		$ps = $pages->find("template=basic-page");	
    		foreach($ps as $p) {
    			$p->setOutputFormatting(false);
    			$new = str_replace('mysite/', '', $p->body);
    			$p->body = $new;
    			$p->save();
    		}
    ?>
    
    • Like 2
  7. Wow horst - that is super awesome; I'll have to revisit this, because i need something like this for a site i'm currently working on, where there is a product and we want to generate a slick product sheet, downloadable pdf using the existing PW content and images...

  8. @pwired - +1 for getting a percent up front, and then keep the site on your development server until you get paid in full..

    i put a coming soon page in the client's domain and then once the site is done, they need to pay the balance before the site is installed on their domain..

  9. i've done that a lot, how you described; but i think diogo is making a good point that there's really no need to be economical in terms of # of fields or templates you use, especially if it makes it easier/cleaner

  10. note this is untested, and i haven't used clone before...but i think you are looking for something like this (though this needs help from a real php person)

    <?php 
    
    $results = $pages->find('title|category.title%='.$config->input->get->q);
    
    $people = new Pagearray();
    
    foreach ($results as $result) {
    	
    	$cats = $result->categories;
    
    		foreach($cats as $cat) {	
    
    			$result = clone $result;
    			$result->category = $cat;
    
    			$people->add($result);
    
    		}
    	
    }
    ?>
    
  11. ok here's something pulled straight from a place i did this:

    <?php
        $gallery = $page->images->findTag('gallery');
        if(count($gallery)) {
        ?>                                
          
        <!-- start gallery -->
                                    
            <?php foreach($gallery as $image) { ?>
    
                <!-- image markup here -->
    
            <?php } //end foreach ?>
    
        <!-- end gallery    -->  
    
    <?php } // end if ?>
    
    • Like 2
×
×
  • Create New...