-
Posts
98 -
Joined
-
Last visited
Posts posted by fenton
-
-
thanks a lot guys!
But it sinks in better if you make faults.true
PW already has $page->next(); and $page->prev(); Can't those be used in this case?the problem is, that I have to traverse folders, since my structure is like this:
News
- 2013
-- 05
--- article 06
--- article 05
--- article 04
--- article 03
--- article 02
-- 06
--- article 01
still wondering though, why from my example above:
if ($pageID == $last_page) { echo "<a href='$prev->url'>prev</a>"; }
doesn't work, even though if I echo both variables the value is the same: 1060 1060
cheers, j
-
thank you guys! will go through your suggestions and report back
-
Hi there,
I feel stupid for asking this
I'm trying to loop through folders with pages that have the template "articles" and want to display "prev I next" buttons, but don't want to display the pipe symbol on the first ot last post. I had it working with the explode version (uncommented code), but it doesn't work if I do it the right way with the PageArray. I'm referring to this post: http://processwire.com/talk/topic/3865-image-tags/?p=37806
<?php $siblings = $pages->find("template=article"); $next = $siblings->getNext($page); $prev = $siblings->getPrev($page); /* $pageID = $page->id; $siblings_array = explode("|", $siblings); $first_page = reset($siblings_array); $last_page = end($siblings_array); if ($pageID == $last_page) { echo "<a href='$prev->url'>prev</a>"; } elseif ($pageID == $first_page) { echo "<a href='$next->url'>next</a>"; } else { echo "<a href='$next->url'>next</a> | <a href='$prev->url'>prev</a>"; } */ $pageID = $page->id; $first_page = $siblings->first(); $last_page = $siblings->last(); if ($pageID == $last_page) { echo "<a href='$prev->url'>prev</a>"; } elseif ($pageID == $first_page) { echo "<a href='$next->url'>next</a>"; } else { echo "<a href='$next->url'>next</a> | <a href='$prev->url'>prev</a>"; } ?>
any ideas what I'm doing wrong?
thanks a lot, j
-
thanks Soma! I was doing the same mistake *explode*
-
You can also try to nest your pages as much as possible (categories) if
that makes more sense and helps with pagination in the Admin
did you check this out? http://processwire.com/talk/topic/2468-module-processdatearchiver/ it's really nice, well done & handy
-
hey kongondo,
thanks, that looks good!
maybe I'm overthinking scenarios e.g. that end users might get confused between creating pages in the tree, then browsing/editing them with Somas module (which works great btw.)
cheers, j
-
Hi there,
I know this has been discussed before, I just got some further questions
let's say I have a news section where my news items get stored in year/month/day-folders automatically using 'processdatearchiver' (http://processwire.com/talk/topic/2468-module-processdatearchiver/)
is there another module besides Somas 'Datatable' (http://processwire.com/talk/topic/704-datatable/) to add, edit, delete posts in a chronological listing? thought I saw another post awhile ago, but am not sure ...
cheers, j
-
If you leave outer tpl empty you should still specify the "||" .. 'outer_tpl' => '||'
Ka-Chiiing! thanks Soma
-
okay, got it "URL Segments" was enabled for that template
kongondo, thanks for posting the solution
*almost finished my first Processwire site*
- 1
-
hey kongondo,
thanks a lot! oddly enough this doesn't work for me ...will keep on trying & report back
j
-
Hi Soma,
first of all, thanks for this great module!
I get the following message displayed:
Notice: Undefined offset: 1 in C:\[...]\site\modules\MarkupSimpleNavigation.module on line 217
and this is one of my calls:
<?php $treeMenu = $modules->get("MarkupSimpleNavigation"); // load the module $rootPage = $page->parents->count == 1 ? $page : $page->parent; $options = array( 'parent_class' => 'active', 'current_class' => 'active', 'max_levels' => 1, 'outer_tpl' => '' ); echo $treeMenu->render($options, null, $rootPage); ?>
any ideas what might cause this, or can I ignore the message?
cheers, j
-
Hi there,
I know, it's probably a really stupid question, but how can I define which page will be shown as 404?
I checked and compared a vanilla PW installation, but can't find out why on the site I'm working on all non existant URLs redirect to the homepage
thanks a lot, cheers, j
-
-
hi Soma, yes
I try to find around, thanks
-
hey kongondo, absolutely!
(...although it's only a tiny gallery made with repeater fields)
- 1
-
thanks a ton, Soma!
-
sorry for being unclear, I meant:
but in that case a portrait image would have the desired width, but exceed the max-height of 320px -
thanks Soma!
but in that case a portrait image would have the desired width, but exceed the max-width of 320px. Ideally, in that case, the max-height of 320px should be taken into account)
(currently trying to port a modx MaxiGallery to processwire)
-
Hi there,
is there a way to change the way images are named (with the size extension) while being uploaded
e.g. dsc02395.jpg will become dsc02395.450x320.jpg. would it be possible to generate something like 450x320_dsc02395.jpg or large_dsc02395.jpg etc?
thanks & cheers, j
-
Hi there,
is there a way to set a max-width + max-height setting for images on upload and keep the aspect ratio?
e.g. a landscape format picture shouldnd't be wider that 450px, as well as not exceed 320px in height and a portrait format image shouldn't be higer than 320px
currently image->size(450,320,$options) will always produce an image 450px wide and 320px high even when it's a portrait format image is
is this somehow possible?
thanks a lot, cheers, j
-
thanks Ryan! will try it out and report back
*edit: yes, it works
-
Hi Soma,
function segmentUrl(HookEvent $event){ $url = $event->return; // requested url $segment = "/about/"; if(strpos($url,$segment) == 0){ $event->return = str_replace(rtrim($segment,'/'),'',$url); } } $wire->addHookAfter('page::path', null, 'segmentUrl');
is this a working example? I tried placing it in my template (url segments are enabled) and changed the segment part to the one I want to strip from my url
cheers & thanks, j
-
hey Marc! thanks
oh, of course, I'm an idiot (no sleep).
- 2
-
hi everyone,
is there a way to only allow 1 image per repeater field (repeater with input type image) to be uploaded. I guess it could be confusing for an user to have the option to upload several pictures for the same repeater item:
thanks a lot, cheers, j
PageArray vs explode
in API & Templates
Posted
adrian - you are right! thanks
Quick glance - do you need to have:
that was the problem