-
Posts
526 -
Joined
-
Last visited
Everything posted by Gazley
-
Hi there, Well, the title says it all. When I access the admin form, it loads straight into Pages. On the top right corner is the "Site" button, but the options to access templates, fields and form builder have completely disappeared? I have cleared down the browser cache, tried different browsers and rebooted my iMac but to no avail. If anyone has a clue what may have happened and more importantly, how to get them back, I'd appreciate it! Cheers!
-
Hey @Soma - it looks like it's a bug in FireFox! http://forum.world.st/Enabling-cookies-causes-callback-links-to-incorrectly-redirect-in-Firefox-td3325969.html I just ran it in debug mode in Chrome and the problem isn't evident. Seems that FireFox redirects to the value in rel=next when cookies are enabled. What the hell! Sorry to have troubled everyone. Bah!
-
The plot thickens ... The first time, the REQUEST_URI is /ProcessWire/gallery/ladies/zowie/ The second time, the REQUEST_URI is /ProcessWire/gallery/ladies/zowie/page2 (as is the REDIRECT_URL) So, it seems that the page is being called twice, and the influence seems to be the link rel=next value. Something seems to be happening outside of my control. I'm not redirecting to page2 or anything like that; I'm only trying to output the link value in the page <head> which is correctly specified as /ProcessWire/gallery/ladies/zowie/page2 when the page is first called.
-
Hi nik, I don't get duplicated output. The HTML is perfect except that the template file specified in the PW template (page-listing.php) runs twice, right from the start. It's called by PW; it's not under my direct control. It's as though the page has redirected to itself so, it just re-renders the whole page so, the markup is perfect, not duplicated. Remember, if I comment out the two lines that specify link rel/prev - it only runs once. Every other page on the site only runs once <shrug>? This is crazy. Thanks.
-
I've also changed the code to the following: <? if ($page->relPrevUrl) { ?> <link rel="prev" href="<?=$page->relPrevUrl?>" /> <? } ?> <? if ($page->relNextUrl) { ?> <link rel="next" href="<?=$page->relNextUrl?>" /> <? } ?> This still causes the double page hit.
-
In my index.php file, I have the following code: <? if ($page->relPrevUrl) echo "<link rel=\"prev\" href=\"{$page->relPrevUrl}\" />", PHP_EOL; ?> <? if ($page->relNextUrl) echo "<link rel=\"next\" href=\"{$page->relNextUrl}\" />", PHP_EOL; ?> Some progress. If I comment out the above code, the page is not executed twice! This seems to be the real issue although there doesn't seem to be anything inherently wrong with this code? Ideas?
-
My supposed "fix" wasn't a fix at all When I corrected the error in my own logic, the guilty page is now nicely rendering on two occasions despite it only being called once via its URL. Here are the steps: Template file called page-listing.php Inside page-listing.php, a small helper template is rendered file as follows: $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/album-photo.php'); $album = $pages->get("/albums/{$input->urlSegment(1)}"); list($prevUrl, $nextUrl, $albumImages) = prevNextImagePaginator($album); $page->metaTitle = $album->get('meta_title|page_h1|title'); $page->metaTitle = $album->meta_desc; $page->relPrevUrl = $prevUrl; $page->relNextUrl = $nextUrl; $t->set('albumImages', $albumImages); $t->set('segmentAlbum', $album); $page->outBody .= $t->render(); At the bottom of page-listing.php, below the above code is: include("./markup/index.php"); index.php contains the default layout and particularly: if ($page->layout) { include("./markup/layouts/{$page->layout}.php"); ... It is the above code that has the breakpoint set that is being hit twice despite calling the page only once? Any ideas?
-
If I can isolate it down to a small reproducible test case, I will. Then you could cast your large green alien eyes over it
-
Agreed, all of my pages work as expected too. Like you said earlier, my template mechanism is different so you aren't easily able to recreate my scenario. I have it working fine now, but I would dearly like to know why it doesn't work in a completely reasonable alternative.
-
>But I don't know what is has to do with what you experience. I don't either, except for what apparently "fixed" the issue. I dynamically created a Template object that needed a value so I attached that value to the page variable instance and inside the template file, it accessed the value through the page variable. In this case, the whole page rendered twice. When I changed the template file to look for the same value but from a "local" variable and did $template->set('variable_name', 'url/value'), the whole page renders only once, just as I would expect. So, this is the reason I asked about usage of the page variable for storing user defined values. Because the value I was storing was a rel next URL, I just wondered whether its URL structure somehow "confused" PW? Thanks any way.
-
Are there any specific rules or guidelines around assigning user-defined variables to the page variable?
-
@Soma - the reason I knew this was happening was because: if ($page->layout) { include("./markup/layouts/{$page->layout}.php"); I had a break-point set on the "include" line above on the main template. I noticed that it stopped twice when I loaded the page in question. Had I not set the break-point, I probably wouldn't have noticed the issue with the page. So, XDebug rocks!
-
If I do the following: $t->set('relNextUrl', $nextUrl); So, assign the value to the TemplateFile instance and not the $page variable, I don't get the page firing twice. So, for some reason, assigning the value of the rel=next URL to the $page instance seems to trigger the firing of the page, twice?
-
What XDebug tells me is that the following line: $page->relNextUrl = $nextUrl; Where $nextUrl is equal to the value: /ProcessWire/gallery/ladies/zowie/page2 Is for some reason, causing the issue? If I comment that line out, the page only executes once?
-
Hi there, I have a single page that when hit executes twice. The page references a urlSegment - that's all there is that is different about the page to the others that just load once, as expected. Any ideas what might be happening here or perhaps some way to track this down? I have tracked right through the code and when it gets to the very end, I find myself back on the first line of the template file once again? Cheers.
-
Hey Guys - this is awesome! I've learned so much and really simplified things. I'm totally blown away with this approach and just how powerful and flexible ProcessWire is! Thanks for all your help and advice!
-
Thanks guys - I think I understand. If I get stuck, I'll come back and ask Cheers!
-
So what do you do in each PW template? Do you specify a template name or file?
-
Hang-on - re-reading Apeisa's post, it seems that index.php is simply included which kind of answers one part of my question. Still not certain about whether 'layout' is a user-defined field.
-
Hi there, I've read Apeisa's post with great interest. What I'm confused about is his reference to $page->layout - it seems that the template file for every page would be index.php with the specific file specified in $page->layout. Am I correct to assume that he has added 'layout' as a field that is included in each PW template? In Setup/Templates, there is an alternative name that can be specified but each page would require to specify it's own layout value. Am I on the right lines with my understanding? Thanks!
-
Hey Ryan, Works for me! Sorry to have inadvertently pushed you into doing something that you probably would have wanted to do at a more convenient time! Thanks for the speedy turnaround Cheers!
-
@Matijn - Ah, I see what you mean and I agree with you!
-
@Matijn - sorry, I don't understand your last point. You didn't like having empty class attribute(s), which turned out to be a feature of the original code so, I have modified the PW code and it no longer renders empty class attributes in paginated code. What are you referring to that "can be done with CSS"? Whether you apply a class value to ordinal first/last <li> or use some kind of CSS pseudo class, it's all CSS. I'm personally not interested in supporting IE7, but there might be others that are. In this case, in IE7, 'first-child' support is unreliable/buggy and 'first-of-type'/'last-of-type' is none existent, even with Selectivizr. So, being able to apply a class to ordinal first/last <li> tags is a convenient alternative that is 100% CSS. Cheers.
-
@Matijn - FYI, I have made a change in the MarkupPagerNav module that removes empty class definitions and forwarded this onto Ryan for his consideration.
-
@Matijn >And I think not spitting out class="" in PHP makes the code much cleaner. It would seem that this is standard behaviour in the PW pagination module. See the following URL and view the source for its paginator: http://processwire.com/skyscrapers/cities/new-york-city/