Marty Walker
-
Posts
629 -
Joined
-
Last visited
-
Days Won
3
Posts posted by Marty Walker
-
-
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.
-
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
-
Sir, you are a gentleman. Thank you. I would not have worked that out.
Regards
Martin
- 1
-
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.
-
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
-
I spoke too soon. That won't highlight if I go down another level.
-
Ahhhh. Thank you!
-
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
-
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.
-
Hi Ryan,
I have both fields set to 1 as each will hold a single image.
'artist_image' holds the full size image
'artist_thumbnail' holds the thumbnail
...both are set to 1. Perhaps I'm doing something else wrong.
-
No problems. I really appreciate all the help you've given me.
-
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>"; }
-
That's done it! Thank you!
-
If I remove this line:
$thumb = $thumb->size(100, 100);
the page renders with the link to the full size image - which is what I'm after.
-
-
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>"; }
-
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
-
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"; }
- 1
-
I think I have it sorted.
if($page->prev->id) {echo "<p class='next'><a href='{$page->prev->url}'>prev</a></p>";} if($page->next->id) {echo "<p class='prev'><a href='{$page->next->url}'>next</a></p>";}
- 1
-
Hi Ryan,
This would be a great feature to have. If only to keep duplicate images to a minimum.
Regards
Martin
-
Thanks again Ryan.
Another noob PHP question. Can I use a conditional to check whether I'm on a first or last page? That way it only outputs 'next page' or 'previous page' if there actually is one.
Regards
Martin
-
Hi,
Am I right is assuming that an uploaded image is only available to that specific page and not any other pages via the admin?
Regards
Martin
-
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.
-
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
misc errors
in General Support
Posted
Thanks for the suggestion. I have tried that. I still get the same errors.