Pergunta

I have a problem with pagination. In my website , I have a function productList which generates a paginated list of products.

The code for the paginate function is shown below:

$this->paginate = array('conditions'=>array($otherconditions,$statuscondition,$active_condition,$catcondition),'order' => $order, 'limit' => 10);

In the view file, the paginator helper is used as follows:

<div class="paginator">
        <span class="info">
    <?php echo $this->Paginator->counter(array('format' => __('Page <strong>{:page}</strong> of <strong>{:pages}</strong>')), array('escape'=>false));
?>  
</span>
 <ul>
<?php echo $this->Paginator->numbers(array('separator' => '', 'tag'=>'li'));?>
  </ul>
   </div>

Suppose, there are 150 products, so with a limit of 10, there will be 15 pages. The problem is that the page numbers are not displayed in the end pages like page 15 i.e when I click on the page number 15, the products are displayed but the paginator counter and paginator number links are not displayed.

I have looked all over the net for a solution but could not find one. Please guide me. PS: the paginate variable depends on my parameters like the category selected , and other conditions. I dont think its a problem with the paginate syntax because the pagination works for small number of pages like 2 or 3. The problem is with paginator helper I think.

Thanks in advance.

I have found the following line when I inspected the HTML. the page number and counter where commented automatically inside the following comments.

    <!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:TrackMoves/>
  <w:TrackFormatting/>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:DoNotPromoteQF/>
  <w:LidThemeOther>EN-US</w:LidThemeOther>
  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   < ...</p></div>

then after this I have the html for the page counter , page number links and also the script files. what is happening. I looked for its meaning and I found that mso 9 is microsoft office 9 or something. Which is not very reasonable. please guid me.

Foi útil?

Solução

I solved this by putting a comment before the closing p tag and div tag. So the comment tag <!--[if gte mso 9] > closes before </p></div>. I also used the php function strip_tags to strip the body of text of all tags. This is a duct tape method. But the problem I found lies in the mce editor.When a user copy pastes a paragraph from a word document to a mce editor thats running in firefox browser, the above mentioned conditional comment is added to the text. So, when displaying the user text, the conditional comment comments out rest of the html after the text. IT is better to work with the mce editor callback to remove the conditional comment which i will be working on now.

Hope this helps someone...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top