Jump to content

pagination and frontpage question


roelof
 Share

Recommended Posts

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 ?>
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 '

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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' />";
}
  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...