-
Posts
868 -
Joined
-
Last visited
-
Days Won
1
Community Answers
-
DaveP's post in cache and css changes was marked as the answer
In AIOM, you can switch to development mode, where CSS is not cached, or delete the cache (there's a button) to make any changes take effect immediately.
-
DaveP's post in page->url based on image was marked as the answer
You can do $file->page (http://cheatsheet.processwire.com/files/file-properties/file-page/) so $filter->page->url should work.
-
DaveP's post in $user->isLoggedin() internal server error was marked as the answer
This kind of error is usually because your code is overwriting the PW $user object. Try making your own user and password variable something like $u and $p, then there is no chance of that happening.
-
DaveP's post in Echo structure incorrect was marked as the answer
I think you can do it simpler than the way you are doing.
<?php $bgimage = $page->Background_Image; $output = "<script> $.backstretch(["; foreach($bgimage as $image){ $output .= '"'.$image->url.'",'; } $output = rtrim($output, ','); $output = "], {duration: 3000, fade: 750});"; echo $output; Usual written-in-browser caveat.
So, what we are doing is building our output as we go along. The main (minor) advantage is that after the end of the foreach we can strip off the last trailing comma using rtrim. It doesn't matter how many background images there are - 1 or n.
Darn! LostKobrakai beat me to it (with a very elegant reply).
-
DaveP's post in Create rows in Foundation automatically was marked as the answer
This should work...
<?php $columns = $page->children; $colcount = $columns->count(); $i = 1; echo '<div class="row">'; foreach ($columns as $column) { if($i == $colcount){ echo "<div class='medium-4 columns end'> <a href='{$column->url}'>$column->title</a>"; } else { echo "<div class='medium-4 columns'> <a href='{$column->url}'>$column->title</a>"; }; if($i % 3 == 0) {echo '</div></div><div class="row">';} else {echo '</div>';} $i++; } echo '</div>'; ?> I have some very similar code to yours in a site currently under development, even including a slight variation on the modulo magic, but I was lazy and applied the 'end' class to every column.
-
DaveP's post in Find pages and filter by multiple pages was marked as the answer
Try
$pages->find('parent=/widgets/')->filter('id=1020|1069|1070|1071|1072|1073|1074|1075|1076')->getRandom(); Might work.
<edit>Removed non-working guess to avoid confusion in future.</edit>
-
DaveP's post in Shopping Cart and repeater fields was marked as the answer
I think you need to tell renderAddToCart() which product it should add, i.e.
$contentThree .= "<span class='sc_add'>" . $modules->get("ShoppingCart")->renderAddToCart($product). "</span>"; See https://github.com/apeisa/Shop-for-ProcessWire/blob/master/ShoppingCart.module#L78
-
DaveP's post in Users keep getting logged out was marked as the answer
mike131 Welcome!
I had a similar issue after running my blog through CloudFlare. Is there any possibility that users' (effective) ip is changing (are they on mobile)? You can easily test/cure by editing /site/config.php
$config->sessionFingerprint = false; If that cures the problem and you are happy to leave fingerprinting off, fine. If you would prefer the higher security, then find out how/why ips are changing and proceed accordingly. (For CloudFlare, for example, I set no caching on mysite.com/processwire/ in a rule thingy they have.)
-
DaveP's post in Unable to log into Processwire website was marked as the answer
That's odd - you should surely get a PW 404 in normal circumstances for any page that PW thinks doesn't exist, not a redirect. Is it a 301 or a 302? (Not that it makes all that much difference.)
Have you got FTP access? Anything in the error log (/site/assets/logs/errors.txt)?
I know you don't expect the client to have changed the .htaccess, but it might be worth renaming it and trying a plain vanilla .htaccess from the PW download, just in case they or the hoster have changed something.