roelof Posted June 19, 2013 Author Posted June 19, 2013 Problem solved. Now solving a few minor css and next links problems and everything looks well. Roelof
Soma Posted June 19, 2013 Posted June 19, 2013 Roelof theres example I did for what you're looking for in that thread over therehttp://processwire.com/talk/topic/3868-pagearray-vs-explode/#entry37919
roelof Posted June 19, 2013 Author Posted June 19, 2013 Thanks I try to understand why this happens. I have this : <a href='{$page->next->url}' But Pw makes this of it : <a href='{$page->next->url}' When I delete the ' then also the layout is messed up. See http://www.tamarawobben.nl
Soma Posted June 19, 2013 Posted June 19, 2013 Only {$page->next->url} won't do anything you need php to echo out the variable. <?php ... ?> to let it know there's php code coming <?php // open php tag echo "<a href='{$page->next->url}'>$page->title</a>"; // end php tag ?> PHP will parse the {vars} if used inside double quoted "string" strings. Or <a href="<?php echo $page->next->url;?>"><?php echo $page->title;?></a> Or if server supports it there's a short notation <?= $page->next->url ?>
roelof Posted June 19, 2013 Author Posted June 19, 2013 Thanks . still no luck. I have this tree : homepage children : - Cities - Architects - Search But if I change page into siblings -> next or parent-next the url stays empty. Roelof
roelof Posted June 19, 2013 Author Posted June 19, 2013 Also this : <a href="<?php echo $sibling->first;?>" class="open-book">BOEK OPENEN</a> is not working. On the source of the page I see then <a href=" " class="open book">BOEK OPENEN </a> Roelof
roelof Posted June 19, 2013 Author Posted June 19, 2013 Found it myself. page->child->url did the trick. Roelof 1
roelof Posted June 20, 2013 Author Posted June 20, 2013 Hello, I did this so another css file is used when im not on the FrontPage. <?php if ($page->id==1) { <link type="text/css" href="<?php echo $config->urls->templates?>styles/twentythings.css" rel="stylesheet" media="screen" /> } if (!$page->id==1) { <link type="text/css" href="<?php echo $config->urls->templates?>styles/twentythings2.css" rel="stylesheet" media="screen" /> } ?> But now I see a 500 error. What did I do wrong ? Roelof Edit 1 : on the error.txt I see this message: Parse Error: syntax error, unexpected '
kongondo Posted June 20, 2013 Posted June 20, 2013 Well, you have all sorts of issues with that code.. For one, you have nested PHP tags inside PHP tags... Have a look at these http://devzone.zend.com/4/php-101-part-1-down-the-rabbit-hole/ What sort of text editor are you using (for your code)?
roelof Posted June 20, 2013 Author Posted June 20, 2013 I do not use a php editor at the moment. I use the text editor of my ftp-server. Can you recommend a good IDE. And I have read it but I do not see what you mean with nested tags. I use first a <php tag Then a if with the then between two {} and another if with also the then between two {} and then the end tag. Roelof
roelof Posted June 21, 2013 Author Posted June 21, 2013 Hello, I have read the documentation but I still do not see the errors. I did a ; after each if line but no luck. Anyone who can help me.
arjen Posted June 21, 2013 Posted June 21, 2013 No offense roelof, but I think it would be wise to take a step back and do some php tutorials. You can drop the last ?>. You can't use php in php. See this example below how to fix it. Notice the {} around the variables and the single quotes in the double quotes. For an editor I'm using Sublime Text 2. Don't edit php files in a textarea please <?php if ($page->id == 1) { echo "<link type='text/css' href='{$config->urls->templates}styles/twentythings.css' rel='stylesheet' media='screen' />"; } 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now