Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Bug with nextLink ?

For some odd reason it seems the nextLink isn't working for me. It plainly doesn't show anything (not even the problem encountered dialogue). Is it a bug? the syntax is:

{$ nextLink n in (folder "folder") $}
    next: <a href="{$n.link$}">{$n.headline$}</a>
{$ end $}

it just shows nothing. same thing with previousLink does same (i.e., nothing). and yes, there are other files in the folder. any clues?

using CD RC.

john doe
Sunday, August 10, 2003

I just tried a similar example and it worked fine.  Can you actually snip the section of code and paste it here?

Joel Goldstick
Sunday, August 10, 2003

The correct syntax is:

{$ nextLink n in (folder "Book") $}
    <a href="{$n.Link$}">Next</a>
{$ end $}
{$ previousLink p in (folder "Book") $}
    <a href="{$p.Link$}">Previous</a>
{$ end $}


The syntax you provided

{$ nextLink n in (folder "folder") $}
    next: <a href="{$n.link$}">{$n.headline$}</a>
{$ end $}

does not match  -- note where the "next" is placed.

works for me and works well :-)

David Mozer
Sunday, August 10, 2003

Complete syntax:

{$foreach 1 x in (folder "news") sortDescendBy .filedDate $}&nbsp;<br />
<div class="box">
<p>{$x.headline$}</p>
<p>{$x.body$}</p>
</div>
{$next$}

{$ nextLink n in (folder "/news") $}
    <a href="{$n.Link$}">Next</a>
{$ end $}
{$ previousLink p in (folder "/news") $}
    <a href="{$p.Link$}">Previous</a>
{$ end $}

This is in the index file. it pulls the latest news article and puts in in the entrance. i guess i could also use $include, but that's not the point :)

in any case, David, i copied and pasted the example from the manual and it still doesn't work. there's no reason for wherever i type text (as opposed to CS) to make a difference. i just wanted the $var.headline to be used as the link

john doe
Sunday, August 10, 2003

You have the script in the index file?  The next/previous script must be in each of the articles in the folder (or whatever the "in" loop is based on.  So, it must be in the template for each of those files.

I think if you just clip your CDScript and put it at the bottom of your template for the articles you will get happy.

Joel Goldstick
Sunday, August 10, 2003

Joel, I think that if John had an index "in" each folder then "that" folders index would contain the effect John desires. Yes, that script is placed in the "template" for the articles in question.

IF, on the other hand John is working with the one "root" index [versus index in each folder] and wishes to have the "Next  Previous" links activated at the root I do not believe that the script was designed for that purpose.

David Mozer
Sunday, August 10, 2003

Hmmm.
the problem was with putting it in the index file.
that is, it was in the index file at the root dir, where as i wanted it to put $previousLink for files in a different dir.

so i put the appropriate CS in the article in the proper dir. it placed it in extra1, and called it up. within the file it worked swell.

when i called up $x.extra1 in the foreach that called up also $x.body, it didn't display the link to the previous and next articles.

any clues how to make this work?

john doe
Sunday, August 10, 2003

I don't really understand the problem but this one works for me. The sidebar contains a thumbnail picture that links to the page. This goes in a template that displays pictures one at a time with links to the previous and next pictures.

<p> {$ previousLink p in (and(thisFolder)(not(fileName "index"))) $}
    <a href="{$p.Link$}">{$p.sidebar$}</a>&nbsp;&lt; <a href="{$p.Link$}">Previous</a>
&nbsp;&nbsp;&nbsp; {$ end $} {$ nextLink n in (thisFolder) $} <a href="{$n.Link$}">Next</a>&nbsp;&gt;<a href="{$n.Link$}">{$n.sidebar$}</a> {$end$} </p>

tk
Sunday, August 10, 2003

*  Recent Topics

*  Fog Creek Home