
taotoo
Members-
Posts
83 -
Joined
Everything posted by taotoo
-
You can add more fields to display by editing the templates for the relevant pages, clicking the Advanced tab, scrolling down to "List of fields to display in the admin Page List", then entering multiple fields such as {title} {a_field} {another_field}. You can also mix in other text, such as {title} | {a_field} > {another_field}.
-
I use Firefox when debugging srcset as unlike Chrome it doesn't do this!
-
I find it useful as unlike Direct Output you can define a variable in your page template and then refer to that variable in your header. I only use a single markup definition, and put all of my template code - excluding header and footer - within it.
-
Is it possible you may be using markup regions? https://processwire.com/docs/front-end/output/markup-regions/ This might explain why it works when you put your code within <div id="content"> ... </div> If you open the _main.php file, can you find the word 'default' in there?
-
Getting images from two difference places and outputting with common code
taotoo replied to taotoo's topic in API & Templates
Thank you DaveP! // Otherwise get images of their book covers else: $source = new WireArray(); foreach($page->page_ref_for_their_books as $a_page): $source->add($a_page->images->first); endforeach; endif; echo $source->first->size(100,100)->url; -
Getting images from two difference places and outputting with common code
taotoo replied to taotoo's topic in API & Templates
Further to this, if I use a foreach as above, it works fine: foreach ($source as $source): echo $source->size(100,100)->url; endforeach; But if I use -> first, it doesn't work: echo $source->first->size(100,100)->url; Is this because I've made a PHP array, and it's the case that ->first only works with ProcessWire arrays? -
@Macrura@jploch I just updated the module and see that you've fixed it - thank you Macrura! On another note, I'm using Admin Theme Canvas and noticed that it and your module don't play well together, so I amended the FieldDescriptionsExtended.module file like this: Lines 236 and 282: if($this->adminTheme == 'AdminThemeUikit' or $this->adminTheme == 'AdminThemeCanvas') { Line 288: if($this->adminTheme != 'AdminThemeUikit' or $this->adminTheme != 'AdminThemeCanvas') { Not sure if that's the sort of thing you would want to include in the module or not, but will leave it here so that it's findable for others.
-
Getting images from two difference places and outputting with common code
taotoo replied to taotoo's topic in API & Templates
If possible I want to have only one section of code for the output, as in reality it's a srcset with lots going on. Though I suppose with your example I could replace the <li> with an include. Otherwise I was wondering if I could build an array, but neither of the two examples below seem to work (the changed lines indicated by asterisks): edit: I had a typo, now it seems both examples below work! // Get images of the author if they exist if $page->images !='': $source = $page->images; // Otherwise get images of their book covers else: foreach($page->page_ref_for_their_books as $a_page): $an_image = $a_page->images->first; * $source[] = $an_image; * endforeach; endif; foreach ($source as $source): echo $source->size(100,100)->url; endforeach; Or: // Get images of the author if they exist if $page->images !='': $source = $page->images; // Otherwise get images of their book covers else: foreach($page->page_ref_for_their_books as $a_page): * $source[] = $a_page->images->first; * endforeach; endif; foreach ($source as $source): echo $source->size(100,100)->url; endforeach; -
Getting images from two difference places and outputting with common code
taotoo replied to taotoo's topic in API & Templates
In my case both scenarios will have multiple images, and I want them to be output with the same img tag, within the same foreach. Maybe I need to change the middle section to something like this. I don't know how to do it though (a wire array maybe?): // Get images of the author if they exist if $page->images !='': $source = $page->images; // Otherwise get images of their book covers else: foreach($page->page_ref_for_their_books as $a_page): $an_image = $a_page->images->first; endforeach; $source = every $an_image merged together to mimic the result of the first condition; endif; foreach ($source as $source): echo $source->size(100,100)->url; endforeach; -
Getting images from two difference places and outputting with common code
taotoo replied to taotoo's topic in API & Templates
The thing is there will be multiple pages in the page reference field, and I want to get the first image from each of them. -
I want to display some images. Sometimes the images will be from the current page's image field. But sometimes they will instead be from the image fields of multiple items in a page reference field. I presume in the first case I'm getting an array of images, but for the second I'm getting something else (junk maybe)? // Get images of the author if they exist if $page->images !='': $source = $page->images; // Otherwise get images of their book covers else: $source = $page->page_ref_for_their_books->images->first; endif; foreach $source as $source: echo $source->size(100,100)->url; endforeach;
-
A bit off-topic, but I was thinking yesterday how in this situation it would be nice if you could also override field names. So when templating, instead of having the below (which is a bit meaningless when you come back to it later): $person->text3 $person->text1 $person->text2 You could instead have: $person->overview $person->quote $person->biography Maybe it wouldn't be possible/practical though.
-
Would love to have this: From https://github.com/ryancramerdesign/ProcessWire/issues/1619 Referenced by this post: Icing on the cake might be:
-
- 5
-
-
I'm an idiot - I was using the RestrictTabView module, with the View tab disabled for non-superusers. (Not sure why this wasn't also affecting the default uikit theme though).
- 46 replies
-
I've just tried the theme with a different website, and the issue isn't there. So it must be something unique to this site, and not the theme.
- 46 replies
-
- 1
-
-
Yes it works fine with the uikit theme, thanks for the help!
- 46 replies
-
Thank you for this theme - it's really excellent! Using a client account with restricted permissions, I noticed that when editing a page the View link in the main navigation bar didn't seem to work. I'm not sure if this is an issue with the theme, or something unique to my setup.
- 46 replies
-
Thank you for this code - it's very useful! One thing I noticed is that when a relevant page is sent to trash, that page doesn't have the option to restore from trash. I think this might be because when pages go to trash they appear to be renamed by ProcessWire. Removing the final line (uniquePageName) seems to solve the issue, but you lose that functionality of course. So based on a post of yours in another thread: ...I added an "isTrash" conditional, as below. Is this a reasonable solution or is there a better way? // Creature if($page->template == 'creature') { // Don't change name field if page is going to trash if(!$page->isTrash) { // If the fields that make up the title are populated if($page->colour->id && $page->animal->id) { // Set the title $page->title = "{$page->colour->title} {$page->animal->title}"; // Sanitize the title as a page name $name = $event->wire()->sanitizer->pageName($page->title, true); // Set the page name while making sure it auto-increments if there is a sibling page with the same title $page->name = $pages->names()->uniquePageName($name, $page); } } } });
-
While trying to style the Page Tree and Lister in an attempt to make them look more similar to each other, I noticed that the color of the text in the lists of page titles didn't match. It turned out that the css above causes the Page Tree page list text to use monochromatic antialiasing (while everywhere else was using subpixel). This was happening in Chrome/Edge on Win10. Firefox on Win10 and Safari in a VM weren't affected by the issue.
-
This module looks great! Should it work with the Reno theme, or are they incompatible?
-
I find this module really useful - thank you for providing it! One thing I'm experiencing: if the field is a Page Reference field, the description heading gets repeated. These are both Page Reference fields: For comparison, these two aren't Page Reference fields, and display correctly:
-
I too failed to get Strategy 2 working, but this does seem to work for me: RewriteCond %{HTTP_ACCEPT} !image/webp RewriteRule (.+)\.webp$ $1.jpg [T=image/jpeg,E=REQUEST_image]
-
Thank you very much Robin!
-
I've appended the following line from wire\modules\Process\ProcessPageSearchLive.php: $selectors[] = "start=$liveSearch[start], limit=$liveSearch[limit]"; Like this: $selectors[] = "start=$liveSearch[start], limit=$liveSearch[limit], sort=template|-created"; But rather than modify the original file, is it possible to achieve the same with a hook?