How do you change value of "nextPageLink"?

9 posts by 2 authors in: Forums > CMS Builder
Last Post: September 30, 2010   (RSS)

I have a blog set up on a site under a directory named "blog" (domain.com/blog/). The index page for the blog is listing 5 posts at a time and then displaying page links to view the older posts. All is working fine with having the blog in it's own directory (e.g., the links to the individual posts are working fine), except for the page links to view the other page(s) of results.

...The code for the nextPageLink is: <a href="<?php echo $listDetails['nextPageLink'] ?>">next &gt;&gt;</a>
...It is returning this link: /blog//page-2/

How do I change the value of "nextPageLink" so I can remove the extra forward slash?

Thanks! -Brian

Re: [Jason] How do you change value of "nextPageLink"?

Thanks for the post Jason! This is what I have in the .htaccess file...

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.hostdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.hostdomain.com$
RewriteRule ^(.*)$ http://www.domain.com/ [R=301,L]

It seems to me that if the "showme" php code returned some of the results listed below, that the extra "/" would be associated with the tag or some other setting and not a rewrite on the domain itself.

[prevPageLink] => /blog//page-/
[nextPageLink] => /blog//page-2/
[firstPageLink] => /blog//page-1/
[lastPageLink] => /blog//page-2/

I don't know if this sheds any new light on the subject. Any ideas?

Thanks!

Re: [rasbro] How do you change value of "nextPageLink"?

By Jason - September 29, 2010

Hi,

Interesting. If you could email your CMS login and FTP details to jason@interactivetools.com I can take a closer look at this for you.

NOTE: Only email this information, don't post it to the forum.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] How do you change value of "nextPageLink"?

Okay Jason, I just sent you that info via email.

Thanks!

Re: [rasbro] How do you change value of "nextPageLink"?

By Jason - September 29, 2010

Hi,

I've got that fixed. What was happening is because you were using the SEO url option, the link uses a "/" instead of a "?" and your URL was www.domain.com/blog/, not www.domain.com/blog/index.php.

If it was the second, your link would look like this:
www.domain.com/blob/index.php/page-2, which would work.

What I did was added this code to your file where you were outputting the links:
<?php $listDetails['nextPageLink']=str_replace("//","/index.php/",$listDetails['nextPageLink']);?>

What this does is put the index.php back into the url if it's not there already. The other option would be to turn off SEO urls.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] How do you change value of "nextPageLink"?

Yes Jason, it's working now, but I have another question though. I understand what you're saying about the format of the URL, which does makes sense why it would act that way with the URL in the format of "www.domain.com/blog/". But if I wanted to change the URL to "www.domain.com/blog/index.php, how do you suggest I do this? I don't see in the viewers where the URL is being specified. Maybe you're referring to the URL the page is naturally resolving to because of the directory structure, which then is what the "nextPageLink" gets appended to. I guess my bottom line question is really just wondering if the solution you added is the simplest and best solution?

Thanks!

Re: [rasbro] How do you change value of "nextPageLink"?

By Jason - September 30, 2010

Hi,

The "index" page is always the default page to be shown, so if you just type in www.domain.com/blog/, that's what will show up. The index.php is assumed. You could get the index.php to show up if you added code at the top to get the page to redirect back to itself.

However, this doesn't really seem necessary. The way the page is set up right now, it will work regardless whether or not the index.php is there.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] How do you change value of "nextPageLink"?

That makes sense Jason, thanks for your help with this!