Jump to content

Marty Walker

Members
  • Posts

    629
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Marty Walker

  1. I cannot say what is causing your first issue, since if those files really are 0444, then you shouldn't see those warnings. The second one: check your parent page template settings: children -> Required Template for Children. You should have "Any" set there, now you might have some template (other than "page") set there, which only allows that template.

    PS: I'm not sure but it might be good to have another setting for default template for children? I know that pw is pretty good guessing what template you want (based on the other children pages), but it's not always right.

    That setting is what I missed. Thanks again.

  2. Hi,

    I'm getting a few errors and I'm not sure what might be causing it.

    First, I get:

    Security Warning: /site/config.php is writable and ideally should not be.
    Security Warning: /site/index.php is writable and ideally should not be.
    

    Both files are set to 444.

    The second is when I try to change the template used by a page.

     Template 'page' is not allowed

    'page' being my template name. The page has no content.

    Regards

    Martin

  3. Thanks for you help and time. It's nearly there except for when I'm on the main Advertising 'list' page. I'm a php ubernoob and I don't understand that code enough. In EE or textpattern this kind of navigation highlighting would take me 2 seconds (with sections and url_segments). I think I'll just hard code it and write a load of CSS. Thanks again. :)

  4. Thanks for the replies. I think I should illustrate more clearly what I'm trying to do.

    Here's the development site: http://otoshpw.clientsite.net.au/

    My pages are structured thusly:

    Home

    -Illustration

    --Advertising

    ---client_work_item

    ---client_work_item

    ---client_work_item

    ---client_work_item

    -Art

    --Limited Edition Prints

    etc, etc

    I'm not including Home in the navigation I'm generating. What I'd like to do, for example, is whenever I'm in a section/page like Advertising or any page under that, have class='current' apply to that LI.

    Regards

    Martin

  5. Hi,

    I'm using the code below to generate a basic navigation:

    <?php 
    foreach($pages->find("parent=/illustration, sort=sort") as $p)
    {
    echo "<li><a href='{$p->url}'>{$p->title}</a></li>";
    }
    

    Works great but I'm trying to work out how to add a class="current" to the LI if that page matches that nav item - and at any level. I've had a go at trying to work out the code in the sitemap template but without any luck.

    <?php
    $nav = $pages->get("/illustration"); 
    $children = $nav->children;
    
    foreach($children as $child) {
    	$current = $child === $page->rootParent ? " class='current'" : '';
    	echo "<li$current><a href='{$child->url}'>{$child->title}</a></li>";
    }
    

    Any thoughts?

    Regards

    Martin

    // adamkiss: added 'php' in your second code block to force code coloring

    // apeisa: added [solved] to subject

  6. Hi Ryan,

    It's in a template called artist_list. My pages are:

    Portfolio - uses template artist_list.php

    - artwork - child page uses template 'artist_work' with two fields - artist_image & artist_thumbnail

    - artwork - etc

    - artwork - etc

    All I'd like to do is generate a thumbnail from the larger image if the thumbnail image isn't present. The child pages won't be viewed as such as I'm calling the larger image into Fancybox.

  7. Thank you again. Your explanation goes some way in helping me learn PW better and I appreciated it.

    If I don't upload a thumbnail and get PW to generate a thumb I get the below error.

    Call to a member function size() on a non-object 

    <?php
    foreach($page->children as $artist_item) {
        $image = $artist_item->artist_image;
        $thumb = $artist_item->artist_thumbnail; 
        if(!$thumb) $thumb = $image;
        $thumb = $thumb->eq(0)->size(100,100);
        echo "<li><a rel='lightbox' title='{$artist_item->title}' href='{$image->url}'><img src='{$thumb->url}' alt='{$artist_item->title}'></a></li>";
    }
    
  8. Hi,

    Thanks for your help. I've started from scratch. I have two fields, artist_image & artist_thumbnail. I get the same errors.

    <?php
    foreach($page->children as $artist_item) {
        $image = $artist_item->artist_image;
        $thumb = $artist_item->artist_thumbnail; 
        if(!$thumb) $thumb = $image;
        $thumb = $thumb->size(100, 100);
        echo "<li><a rel='lightbox' title='{$artist_item->title}' href='{$image->url}'><img src='{$thumb->url}' alt='{$artist_item->title}'></a></li>";
    }
    
  9. Thanks Ryan,

    I get all sorts of errors if I try that code.

    Exception: Method Pageimages::size does not exist or is not callable in this context (in /Users/me/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/wire/core/Wire.php line 205)
    
    #0 [internal function]: Wire->__call('size', Array)
    #1 /Users/me/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/site/templates/template.php(90): Pageimages->size(100, 100)
    #2 /Users/me/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/wire/core/TemplateFile.php(88): require('/Users/me/S...')
    #3 /Users/me/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/wire/core/Wire.php(241): TemplateFile->___render()
    #4 /Users/me/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/wire/core/Wire.php(203): Wire->runHooks(Array, Array)
    #5 [internal function]: Wire->__call('render', Array)
    #6 /Users/martin/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/wire/modules/PageRender.module(144): TemplateFile->render('render', Array)
    #7 /Users/martin/Sites/ProcessWire/ryancramerdesign-ProcessWire-TEST/wire/core/Wire.php
    
  10. Hi,

    I'm trying to get my head around something I know should be simple. I'm working on an a site for an artist who'd like to upload a custom thumbnail for each of his images. I've added a second field called 'artist_thumbnail'. In my template I want to test to see if there's a custom thumbnail and if not get processwire to generate one automatically.

    PHP isn't my strong point. Am I even close with this code?

    foreach($page->children("limit=32") as $folio_item) {
    
    if($folio_item->artist_thumbnail) {
            $img = "<li><a rel='lightbox' title='{$folio_item->title}' href='{$image->url}'><img title='{$folio_item->title}' src='{$thumb->url}' alt='{$folio_item->title}'></a></li>";
    } else if($folio_item->artist_image) {
            $thumb = $folio_item->artist_image->size(100, 100);
            $image = $folio_item->artist_image;
            $img = "<li><a rel='lightbox' title='{$folio_item->title}' href='{$image->url}'><img title='{$folio_item->title}' src='{$thumb->url}' alt='{$folio_item->title}'></a></li>";
        } 
    // Output the image
    echo "$img";
    }
    
    
    • Like 1
  11. Hi everyone,

    Ryan, that's exactly what I meant.

    Jim, actually I'm thinking Martin's talking about the next/previous sibling, rather than pagination. Though reading it again, now I'm not sure. :) Martin, can you confirm? Either way, I do need to add those next/prev sibling API functions.

  12. Hi,

    This is my first post here and I'm a bit of a php noob - but willing to learn nonetheless. I really like approach of this CMS. I think it'd be a fantastic offering to a lot of my clients.

    My first question (probably of many) is regarding next/previous page linking. I'm picking through the demo site code and say, for example I'm on the About Us > Child page example 1. How would I go about adding a next / previous page link that works only on that level?

    Thanks & regards

    Martin

×
×
  • Create New...