Jump to content
roelof

pagination and frontpage question

Recommended Posts

Problem solved.  Now solving a few minor css and next links problems and everything looks well.

Roelof

Share this post


Link to post
Share on other sites

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 ?>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 '

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...