Keyword

Uber Page Break does not create sef urls

  • Adamo
  • Adamo's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 2 months ago #94093 by Adamo
Good morning at all guys,

i've just find an error in UberPageBreak plugin that omitted of insert the limit parameter in the generated urls, so sh404sef creates wrong urls.

 

I've fix the problem by adding the limit parameter at lines 164, 189, 210. The strange thing is that when the plugin creates the url for prev and next buttons and for the "One page" visualitation, it adds the parameter and urls work correctly. This should be an oversight.

 

But there is more. The urls generated by the plugin are the type of "Page-x.html". So i've edit also the sh404sef code to permit the correct handling of the pagination in K2. I contacted the sh404sef's developers and they tell me taht they should be very happy to insert my editing in their code. So i contacted also JoomlaWorks (by the contact form on their site) to explain them what i done but they don't reply me. So i'ìm writing here, hoping someone can read this post and fix the UberPagePlugin issues.

 

If you like to have more axplanation i'm here :)

 

Adamo "Aerendir" Crespi

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago #94094 by AdrianK
Replied by AdrianK on topic Uber Page Break does not create sef urls
Hello,

 

I think its a serious bug of the sh404sef router, because every page as limitstart,

cause Page-1.

Please Log in or Create an account to join the conversation.

  • Adamo
  • Adamo's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 1 month ago #94095 by Adamo
Replied by Adamo on topic Uber Page Break does not create sef urls
Titus said:

Hello,

 

I think its a serious bug of the sh404sef router, because every page as limitstart,

cause Page-1.



 

Hi Titus, no it is not an sh404sef bug but an oversight in uberpagebreak: you have to add the limit parameter at lines 

162, 187, 208. The result is this

 

@Willem Here is the solution.

 

161 // TOC page link

162 $output->links[$key]->pagelink = JRoute::_('&limit=1&showall=&limitstart='.($i-1));

 


 

186 // TOC footer link

187 $output->footerLink = JRoute::_('&limit=1&showall=1&limitstart=');

 


 

208 $output->navNextLink = JRoute::_('&limit&limitstart='.$page_next);

 

Final notes

These edits solve only the pagination issue. The resulting url is ever in the form page-x.html because it is handled by the sh404sef general engine.

If you want to use the aliases or the titles of your articles to create the urls it is necessary to integrate uberPageBreak with SH404Sef. Yannik (Sh404SEF) knows the problem. It is necessary the small update in the plugin UberPageBreak by JoomlaWorks so also sh404sef will be updated and the integration will be in production releases.

 

But at that time anyone from JoomlaWorks reply me here in the forum or by email (i sent them an email from their site explicating the problem and the solution).

 

We are waiting for them :(

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #94096 by Brenda
Replied by Brenda on topic Uber Page Break does not create sef urls
which file did you change?

 

Please Log in or Create an account to join the conversation.

  • Adamo
  • Adamo's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 11 months ago #94097 by Adamo
Replied by Adamo on topic Uber Page Break does not create sef urls
We are talking about UberPageBreak: you have to edit the plugin .php file in plugins folder.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #94098 by Brenda
Replied by Brenda on topic Uber Page Break does not create sef urls
Okay I found it:  /plugins/content/UberPageBreak.php 

Thanks for posting this!!  I was having problems with using UberPageBreak with SH404SEF.  I'm using the Tabs template.  I have three tabs and the 3rd tab didn't work until I first click on Page 3 at the bottom of my article. These changes work perfectly!!

Please Log in or Create an account to join the conversation.

  • Adamo
  • Adamo's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 11 months ago #94099 by Adamo
Replied by Adamo on topic Uber Page Break does not create sef urls
Hi martin,

i can't write the changes i made because now there are new versions of sh404sef and i don't know if there are well for the actual version.

 

Anyway, in the file administrator/components/com_sh404sef/sh404sef.class.php i duplicated the virtuemart section and adapt it for k2. In this way i also obtain the url builded by alias and not by the general string "page-x".

 

If not remember wrong (i didn't made this change at this time and for a lot of time) the problem you have is caused because k2 and uberpagebrak aren't integrated with sh404sef.

 

To solve definitely the problem it is necessary that sh404sef team and the k2/uberPageBreak one work together to solve the problem. At this time i sent an email to JoomlaWorks but no one replied me and we have the problem yet.

If some one other send them an email maybe possibile the teams solve the problem.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #94100 by Brenda
Replied by Brenda on topic Uber Page Break does not create sef urls
I made changes to Uberpagebreak not SH404SEF

I changed this file:

/plugins/content/UberPageBreak.php

and changed these lines:

161 // TOC page link

162 $output->links[$key]->pagelink = JRoute::_('&limit=1&showall=&limitstart='.($i-1));

 


 

186 // TOC footer link

187 $output->footerLink = JRoute::_('&limit=1&showall=1&limitstart=');

 


 

208 $output->navNextLink = JRoute::_('&limit&limitstart='.$page_next);

 

The whole file looks like this:

&lt;?php /*// JoomlaWorks "UberPageBreak" Plugin for Joomla! 1.5.x - Version 1.0// Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.// Released under the GNU/GPL license: www.gnu.org/copyleft/gpl.html// More info at www.joomlaworks.gr// Designed and developed by the JoomlaWorks team// ***Last update: June 25th, 2010****/// no direct accessdefined('_JEXEC') or die('Restricted access');jimport( 'joomla.plugin.plugin' );class plgContentUberPageBreak extends JPlugin {  // JoomlaWorks reference parameters    var $plg_name                                = "UberPageBreak";    var $plg_copyrights_start        = "\n\n<!-- JoomlaWorks \"UberPageBreak\" Plugin (v1.0) starts here -->\n";    var $plg_copyrights_end            = "\n<!-- JoomlaWorks \"UberPageBreak\" Plugin (v1.0) ends here -->\n\n";            function plgContentUberPageBreak( &$subject, $params ){        parent::__construct( $subject, $params );    }        function onPrepareContent( &$row, &$params, $page=0 ){                // API    $mainframe    = &JFactory::getApplication();        $document     = &JFactory::getDocument();        $db                    = &JFactory::getDBO();                // Requests        $option         = JRequest::getCmd('option');        $view             = JRequest::getCmd('view');        $layout         = JRequest::getCmd('layout');        $itemid         = JRequest::getInt('Itemid');        $print           = JRequest::getBool('print');        $limitstart = JRequest::getInt('limitstart',0);        $showall         = JRequest::getInt('showall',0);        if(!$page) $page = 0;                        // Assign paths    $sitePath = JPATH_SITE;    $siteUrl  = substr(JURI::root(), 0, -1);        // Check if plugin is enabled    if(JPluginHelper::isEnabled('content',$this->plg_name)==false) return;            // Load the plugin language file the proper way        JPlugin::loadLanguage('plg_content_'.$this->plg_name, JPATH_ADMINISTRATOR);        // Simple performance checks to determine whether plugin should process further      if(strpos($row->text,'class="system-pagebreak')===false && strpos($row->text,'class=\'system-pagebreak')===false){          return true;      }            // Expression to search for        $regex = '#<hr([^&gt;]*?)class=(\"|\')system-pagebreak(\"|\')([^&gt;]*?)\/*&gt;#iU';                      if($params-&gt;get('intro_only') || $params-&gt;get('popup') || ($view!= 'article' &amp;&amp; $view!='item')){            $row-&gt;text = preg_replace($regex,'',$row-&gt;text);            return;        }                // For K2        if($option=='com_k2'){            if(!empty($row-&gt;fulltext)){                $row-&gt;text = $row-&gt;fulltext;            } else {                $row-&gt;text = $row-&gt;introtext;            }        }                // Clear pagebreak tags on print page        if(JRequest::getInt('print')){            $row-&gt;text = preg_replace($regex,'&lt;br /&gt;',$row-&gt;text);            return;        }                //
Get plugin parameters
                // Get Plugin info        $plugin =&amp; JPluginHelper::getPlugin('content',$this-&gt;plg_name);        $pluginParams = new JParameter( $plugin-&gt;params );                $pluginTemplate = $pluginParams-&gt;get('pluginTemplate','Default'); // to add to XML: Default or Tabs incl. on-the-fly MVC        $ubpPageTitle        = $pluginParams-&gt;get('ubpPageTitle',1);        $ubpTOC                 = $pluginParams-&gt;get('ubpTOC',1);        $ubpNavigation     = $pluginParams-&gt;get('ubpNavigation',1);        $ubpAllPagesLink= $pluginParams-&gt;get('ubpAllPagesLink',1);        $ubpPageCounter = $pluginParams-&gt;get('ubpPageCounter',1);        // Includes        require_once(dirname(__FILE__).DS.$this-&gt;plg_name.DS.'includes'.DS.'helper.php');        //
Head includes
        $pluginCSS         = UberPageBreakHelper::getTemplatePath($this-&gt;plg_name,'css/template.css',$pluginTemplate);        $pluginCSS         = $pluginCSS-&gt;http;        $headIncludes = '&lt;style type="text/css" media="all"&gt;    @import "'.$pluginCSS.'";&lt;/style&gt;        ';        //
Prepare the output
                // Find all instances of plugin and put in $matches        $matches = array();        preg_match_all($regex, $row-&gt;text, $matches, PREG_SET_ORDER);        // Split the text around the plugin        $text = preg_split($regex, $row-&gt;text);            // Count the number of pages        $n = count($text);        // We have found at least one plugin instance, therefore at least 2 pages        if($n &gt; 1){                    $output = new JObject;                        // TOC header title            $output-&gt;headerTitle = $row-&gt;title;                        // Set the page title            if($ubpPageTitle &amp;&amp; $page){                $page_text = $page + 1;                if($page &amp;&amp; @$matches[$page-1][2]){                    $attrs = JUtility::parseAttributes($matches[$page-1][0]);                    if(@$attrs){                        $row-&gt;title = $row-&gt;title.' - '.$attrs;                    } else {                        $thispage = $page + 1;                        $row-&gt;title = $row-&gt;title.' - '.JText::_( 'Page' ).' '.$thispage;                    }                }            }                        // TOC header link            $output-&gt;headerLink = JRoute::_('&amp;showall=&amp;limitstart=');                        // TOC header active class            $output-&gt;headerActiveClass = ($limitstart === 0 &amp;&amp; $showall === 0) ? true : false;                        $i = 2;            foreach($matches as $key=&gt;$match){                            $key = $key + 1;                                $output-&gt;links[$key] = new JObject;                            // TOC page link                 $output-&gt;links[$key]-&gt;pagelink = JRoute::_('&amp;limit=1&amp;showall=&amp;limitstart='.($i-1));                                // TOC page title                if(@$match[0]){                    $attrs2 = JUtility::parseAttributes($match[0]);                    if(@$attrs2){                        $title = stripslashes($attrs2);                    } elseif(@$attrs2) {                        $title = stripslashes($attrs2);                    } else {                        $title = JText::sprintf('Page #',$i);                    }                } else {                    $title = JText::sprintf('Page #',$i);                }                $output-&gt;links[$key]-&gt;title = $title;                                // TOC page active &amp; odd/even classes                $output-&gt;links[$key]-&gt;linkActiveClass = ($limitstart == $i-1) ? true : false;                $output-&gt;links[$key]-&gt;linkOddOrEvenClass = ($key%2) ? 'odd' : 'even';                                $i++;            }                        // TOC footer link            $output-&gt;footerLink = JRoute::_('&amp;limit=1&amp;showall=1&amp;limitstart=');                        // TOC footer active class            $output-&gt;footerActiveClass = ($showall == 1) ? true : false;            // Article text - we clean it up from the plugin tags on each created page            $output-&gt;text[$page] = str_replace("&lt;hr id=\"\"system-readmore\"\" /&gt;", "", $text[$page]);                                    // Page navigation            jimport('joomla.html.pagination');            $pageNavigation = new JPagination($n, $page, 1);                    // Page counter            $output-&gt;pageCounter = $pageNavigation-&gt;getPagesCounter();            // Page navigation links            $output-&gt;navPageLinks = $pageNavigation-&gt;getPagesLinks();            // Prev/Next navigation links            if($page&lt;$n-1 &amp;&amp; !$showall){                $page_next = $page + 1;                $output-&gt;navNextLink = JRoute::_('&amp;limit&amp;limitstart='.$page_next);                $output-&gt;navNextText = JText::_('Next').' '.JText::_('&amp;gt;&amp;gt;');            } else {                $output-&gt;navNextLink = '';                $output-&gt;navNextText = JText::_('Next');            }                    if($page&gt;0 &amp;&amp; !$showall){                $page_prev = ($page - 1 == 0) ? "" : $page - 1;                $output-&gt;navPrevLink = JRoute::_('&amp;limitstart='.$page_prev);                $output-&gt;navPrevText = JText::_('&amp;lt;&amp;lt;').' '.JText::_('Prev');            } else {                $output-&gt;navPrevLink = '';                $output-&gt;navPrevText = JText::_('Prev');            }                                                //
Render the output
            // Load the head includes            //UberPageBreakHelper::loadHeadIncludes($this-&gt;plg_copyrights_start.$headIncludes.$this-&gt;plg_copyrights_end);            //$document-&gt;addCustomTag($this-&gt;plg_copyrights_start.$headIncludes.$this-&gt;plg_copyrights_end);            $document-&gt;addStyleSheet($pluginCSS);            // Set the "all pages" output            if($showall &amp;&amp; $ubpAllPagesLink){                $page = 1;                $output-&gt;pageText = preg_replace($regex,'&lt;br /&gt;', $row-&gt;text);            } else {                $output-&gt;pageText = $output-&gt;text[$page];            }                        // Fetch the template            ob_start();            $getTemplatePath = UberPageBreakHelper::getTemplatePath($this-&gt;plg_name,'default.php',$pluginTemplate);            $getTemplatePath = $getTemplatePath-&gt;file;            include($getTemplatePath);            $getTemplate = $this-&gt;plg_copyrights_start.ob_get_contents().$this-&gt;plg_copyrights_end;            ob_end_clean();                        // Do the replace            if($option=='com_k2'){                if(!empty($row-&gt;fulltext)){                    $row-&gt;text = $row-&gt;introtext.'{K2Splitter}'.$getTemplate;                } else {                    $row-&gt;text = $getTemplate;                }            } else {                $row-&gt;text = $getTemplate;            }                    }    }} // End class/*** LEGEND: Page break plugin** &lt;b&gt;Usage:&lt;/b&gt;* &lt;code&gt;&lt;hr class="system-pagebreak" /&gt;&lt;/code&gt;* &lt;code&gt;&lt;hr class="system-pagebreak" title="The page title" /&gt;&lt;/code&gt;* or* &lt;code&gt;&lt;hr class="system-pagebreak" alt="The first page" /&gt;&lt;/code&gt;* or* &lt;code&gt;&lt;hr class="system-pagebreak" title="The page title" alt="The first page" /&gt;&lt;/code&gt;* or* &lt;code&gt;&lt;hr class="system-pagebreak" alt="The first page" title="The page title" /&gt;&lt;/code&gt;**/

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #94101 by Brenda
Replied by Brenda on topic Uber Page Break does not create sef urls
yes it fixed it and I was having the same problem as you

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #94102 by AdrianK
Replied by AdrianK on topic Uber Page Break does not create sef urls
Hi Martin,

can you please support a download-link?

 

I have trouble with the native joomla seo and urls of K2. With artio joomlsef 3

and a k2-plugin uberpagebreak generates correct urls, I think its possibly a

problem with the native sef of joomla and the page-property, limitstart is

not absolute.

 

Best regards,

Titus

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum