ProBlog Prev/Next
Permalink Browser Info Environment
In pb_post.php, for my actual blog post, somehow the prev/next links are coming up with the URL of the post page being viewed.
I'm scratching my head... I've just installed and setup ProBlog on another site using very similar theme coding, and no issues. On this one, it's like those variables $prev_link and $next_link are just broke.
If I drop a next/prev block onto the PB-post page type, and set up on children, that works to navigate back and forth. I'm tempted to just cut out the pagination from pb-post and just use a regular prev/next block via the page type. That would fix me, but it bugs the snot out of me to not know why this is mysteriously failing. Many installs of PB, it usually works... <rolleyes> the site *is* on GoDaddy though. Miracle C5 is running at all there... but it is running like a champ.
Environment:
# concrete5 Version
5.6.1.2
# concrete5 Packages
Pro Blog (11.9.8).
# concrete5 Overrides
blocks/page_list, blocks/autonav, blocks/form, blocks/news_blurb, blocks/problog_date_archive, blocks/problog_list, blocks/search, blocks/content, blocks/next_previous, themes/racesmart
Code from pb_post.php (which I am overriding in my local page_types folder)
I'm scratching my head... I've just installed and setup ProBlog on another site using very similar theme coding, and no issues. On this one, it's like those variables $prev_link and $next_link are just broke.
If I drop a next/prev block onto the PB-post page type, and set up on children, that works to navigate back and forth. I'm tempted to just cut out the pagination from pb-post and just use a regular prev/next block via the page type. That would fix me, but it bugs the snot out of me to not know why this is mysteriously failing. Many installs of PB, it usually works... <rolleyes> the site *is* on GoDaddy though. Miracle C5 is running at all there... but it is running like a champ.
Environment:
# concrete5 Version
5.6.1.2
# concrete5 Packages
Pro Blog (11.9.8).
# concrete5 Overrides
blocks/page_list, blocks/autonav, blocks/form, blocks/news_blurb, blocks/problog_date_archive, blocks/problog_list, blocks/search, blocks/content, blocks/next_previous, themes/racesmart
Code from pb_post.php (which I am overriding in my local page_types folder)
<div class="ccm-next-previous-wrapper"> <br/> <?php if ($prev_link){ ?> <div class="ccm-next-previous-previouslink"> <?php echo '<a href="'.$prev_link.'" alt="prev_page"><i class="icon icon-chevron-sign-left icon-2x" style="position: relative; top: 5px; margin-right: 4px;"></i> '.t('Previous').'</a>';?> </div> <?php } if ($next_link){ ?> <div class="ccm-next-previous-nextlink"> <?php echo '<a href="'.$next_link.'" alt="next_page">'.t('Next').' <i class="icon icon-chevron-sign-right icon-2x" style="position: relative; top: 5px; margin-left: 4px;"></i></a>';?> </div>
Viewing 15 lines of 20 lines. View entire code block.
Type: | Discussion |
---|---|
Status: | New |
I actually had all caching in C5 turned off for development... I just went and turned on the full page if blocks allow it, cleared the cache, and reloaded pages... but no success. In fact, my prev next links don't print at all unless I remove the from wrapping them. For some reason $prev_link and $next_link seem to be empty? But if I take the if statement out, they print links, just the links are to the page being viewed..
if($var){ }
I'm wondering, are you using a page_type other than pb_post?
pb_post has a page_type controller file that processes next/prev because the C5 version of the next/prev block errantly loops ALL pages in your site, and then filters....very db intensive and can slow a site down. So pb_post bypasses the block and prints it's own version, which is processed in the page_type controller.
ChadStrat
pb_post has a page_type controller file that processes next/prev because the C5 version of the next/prev block errantly loops ALL pages in your site, and then filters....very db intensive and can slow a site down. So pb_post bypasses the block and prints it's own version, which is processed in the page_type controller.
ChadStrat
Good info to know about the C5 prev/next, but no... I am using the PB Post page type
see attached pic
see attached pic
can you try copying the /packages/problog/controllers/page_types/pb_post.php to your root /controllers/page_types/ folder and see if it then sees the next/prev vas?
ChadStrat
ChadStrat
That didn't visibly change anything, moving the controller page_type pb_post to the root override.
The ccm-next-previous-wrapper just prints out empty on the page.
what does "vas" as in "sees the next/prev vas" mean?
The ccm-next-previous-wrapper just prints out empty on the page.
what does "vas" as in "sees the next/prev vas" mean?
I am actually having the same issue, did you ever get to the bottom of this?
The prev/next returns blank.
I have tried with a new theme Page Type of projects_post.php with a controller in the page_types/projects_post.php
then i changed the header part to be
but nothing shows up.
Can you help?
The prev/next returns blank.
I have tried with a new theme Page Type of projects_post.php with a controller in the page_types/projects_post.php
then i changed the header part to be
class ProjectPostPageTypeController extends Controller {
but nothing shows up.
Can you help?
I apparently never did get it working, as I just elected not to have prev/next on the blog post pages. Maybe Chad can help you. Sorry!
The C5 Next/Prev block had a nasty bug (and still does) whereas it looped through ALL pages every time. For our users that had hundreds/thousands of posts, this became a serious performance issue.
So the pb_post page_type has a controller file that gets the next/prev links.
If you have a custom page_type, you don't have this controller.
You can open up /packages/problog/controllers/page_types/pb_post.php and copy those methods and then make sure you add those as well as the following to your custom page_type controller:
- create a file in your root /controllers/page_types/ folder of the same name as your single page.
if your custom page_type name is "custom_pagetype" then the file should look like so:
So the pb_post page_type has a controller file that gets the next/prev links.
If you have a custom page_type, you don't have this controller.
You can open up /packages/problog/controllers/page_types/pb_post.php and copy those methods and then make sure you add those as well as the following to your custom page_type controller:
/* Add these inside of your single page controller view(){} method */ $this->set('next_link',$this->getNextPost()); $this->set('prev_link',$this->getPrevPost());
- create a file in your root /controllers/page_types/ folder of the same name as your single page.
if your custom page_type name is "custom_pagetype" then the file should look like so:
<?php defined('C5_EXECUTE') or die("Access Denied."); class CustomPagetypePageTypeController extends Controller { public function view(){ $blogify = Loader::helper('blogify','problog'); $settings = $blogify->getBlogSettings(); $embedlykey = $settings['embedly']; $this->set('next_link',$this->getNextPost()); $this->set('prev_link',$this->getPrevPost()); $html = Loader::helper('html'); $this->addHeaderItem($html->css('page_types/pb_post.css', 'problog')); if($embedlykey){ $this->addHeaderItem($html->javascript('jquery.embedly.js','problog')); $this->addFooterItem(" <script type=\"text/javascript\">
Viewing 15 lines of 61 lines. View entire code block.
Thanks for the reply,
I have tried this and it doesn't seem to work.
a page called project_post.php in the page_types folder with this code
then I have a project_post.php in the controllers/page_types with this code
am I missing something?
I have tried this and it doesn't seem to work.
a page called project_post.php in the page_types folder with this code
<?php defined('C5_EXECUTE') or die("Access Denied."); global $c; $u = new User(); $blogify = Loader::helper('blogify','problog'); $authorID = $blogify->getBlogAuthor($c); $blog_settings = $blogify->getBlogSettings(); extract($blog_settings); ?> <div id="maincontent" class="container clearfix"> <div class="one-fourth column alpha secondary"> <div class="sidemenu"> <?php $a = new Area('sidebar'); $a->display($c); ?>
Viewing 15 lines of 45 lines. View entire code block.
then I have a project_post.php in the controllers/page_types with this code
<?php defined('C5_EXECUTE') or die("Access Denied."); class ProjectPostPageTypeController extends Controller { public function view(){ $blogify = Loader::helper('blogify','problog'); $settings = $blogify->getBlogSettings(); $embedlykey = $settings['embedly']; $this->set('next_link',$this->getNextPost()); $this->set('prev_link',$this->getPrevPost()); $html = Loader::helper('html'); $this->addHeaderItem($html->css('page_types/pb_post.css', 'problog')); if($embedlykey){ $this->addHeaderItem($html->javascript('jquery.embedly.js','problog')); $this->addFooterItem(" <script type=\"text/javascript\">
Viewing 15 lines of 61 lines. View entire code block.
am I missing something?
Debug this my friend. Debug.
Start adding var_dump($var);exit; in various steps in that controller to see what is happening.
I couldn't say honestly.
If you add var_dumps and C5 doesn't even see it, then that means you have something named wrong or placed in the wrong spot.
It's worth noting, that if you have a THEME page type, you will want that in the THEME controllers folder. If you have a root page_type, you then want that in the root controllers dir.
ChadStrat
Start adding var_dump($var);exit; in various steps in that controller to see what is happening.
I couldn't say honestly.
If you add var_dumps and C5 doesn't even see it, then that means you have something named wrong or placed in the wrong spot.
It's worth noting, that if you have a THEME page type, you will want that in the THEME controllers folder. If you have a root page_type, you then want that in the root controllers dir.
ChadStrat
well thank you for you help, but I really don't understand.
Everything seems in the right place nothing is working.
I tried adding the var dump and nothing can up.
I have now placed the file project_post.php in the _root/page_types folder.
I then have project_post.php in the _root/controllers/page_types
the link only show link to the current page once I take off
the $prev_link must be set somewhere as the links have the current page showing as the href how can I tell if it is pulling in the controller to start with?
If i gave you FTP details could you take a look? I am not sure if it is the plugin that is not working or the way I have set it up?
Everything seems in the right place nothing is working.
I tried adding the var dump and nothing can up.
I have now placed the file project_post.php in the _root/page_types folder.
<?php defined('C5_EXECUTE') or die("Access Denied."); global $c; $u = new User(); $blogify = Loader::helper('blogify','problog'); $authorID = $blogify->getBlogAuthor($c); $blog_settings = $blogify->getBlogSettings(); extract($blog_settings); ?> <div id="maincontent" class="container clearfix"> <div class="one-fourth column alpha secondary"> <div class="sidemenu"> <?php $a = new Area('sidebar'); $a->display($c); ?>
Viewing 15 lines of 37 lines. View entire code block.
I then have project_post.php in the _root/controllers/page_types
<?php defined('C5_EXECUTE') or die("Access Denied."); class ProjectPostPageTypeController extends Controller { public function view(){ $blogify = Loader::helper('blogify','problog'); $settings = $blogify->getBlogSettings(); $embedlykey = $settings['embedly']; $this->set('next_link',$this->getNextPost()); $this->set('prev_link',$this->getPrevPost()); $html = Loader::helper('html'); $this->addHeaderItem($html->css('page_types/pb_post.css', 'problog')); if($embedlykey){ $this->addHeaderItem($html->javascript('jquery.embedly.js','problog')); $this->addFooterItem(" <script type=\"text/javascript\">
Viewing 15 lines of 61 lines. View entire code block.
the link only show link to the current page once I take off
<?php if($prev_link){ ?>
the $prev_link must be set somewhere as the links have the current page showing as the href how can I tell if it is pulling in the controller to start with?
If i gave you FTP details could you take a look? I am not sure if it is the plugin that is not working or the way I have set it up?
FYI, I found that if you are using a site DIR_REL (relative path) for your concrete5 install, the code doesn't handle it (or at least the instance of the code I got the privilege of troubleshooting).
I posted my fix to the controller functions over athttp://www.concrete5.org/index.php?cID=628232...
I posted my fix to the controller functions over athttp://www.concrete5.org/index.php?cID=628232...
ChadStrat