Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hello Couchees!
I have just looked, but have not found in the forum the similar problem to the one I excperience now. It is very strange...

I have thumbnails with the k_page_link, but when I click on them they lead my to the last cloned page in the folder, not to the specific page that belongs to the thumbnail...
In the administrator view, when I try to view single cloned pages (I just click on the "view" button) I also do not get the one specific page. Like, I click on the VIEW button and I see that the path to the singular page is correct, because it is shown in the browser, but what shows in the browser window is just the last cloned page again...

In the folder view I have this code
Code: Select all
 <ul class="small-block-grid-1 medium-block-grid-3 large-block-grid-3 start-p gruppe">
                 <cms:pages masterpage='referenzen.php' folder=k_folder_name  > 
                 <li><a href="<cms:link masterpage='referenzen.php' page=k_page_name />"><div class="reflabel"><cms:show ref_label /></div><img src="<cms:show my_image_thumb />"></a></li>
          </cms:pages>       

</ul>



And the page view is paginated. Here is the code.

Code: Select all
<cms:pages masterpage='referenzen.php' folder=k_page_foldername limit='1' paginate='1'>
    <div class="row">
  <!--LEFT SIDE COLUMN-->
     <div class="large-4 medium-4  small-12 columns parole">
      <div class="disappearsmall">
     <cms:show beschreibung />
        </div>
     
  </div><!--end LEFT SIDE COLUMN-->

        <!--CONTAINER-->
     <div class="large-8 medium-8 small-12 columns bild">
          <div class="start-p">
              <!--<h3><cms:show k_page_foldertitle /></h3>-->
              <div class="crumbs"> <cms:breadcrumbs separator='&nbsp;>>&nbsp;' include_template='1'/>&nbsp;>>&nbsp;<cms:show ref_label /></div>
              <div class="start-p" ><cms:paginator prev_text='&#171;' next_text='&#187'/></div>
                <div class="appearsmall">
     <cms:show beschreibung />
        </div>
             <ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1 start-p mycentered">
                 <cms:show_repeatable 'my_multiple_images' >
                 <li class="refhr"><img src="<cms:show my_image/>" /></li>
              </cms:show_repeatable>
</ul>
</div>
</div>
    </div> 
</cms:pages> 


But as I said, links form the admin panel are also acting weird...I checked with Firebug, and textually, all links generated by k_page_link appear correct...but they do not lead correctly....


Any idea what this might be?


Thanks in advance
Tanja
Hi Tanja,
all links generated by k_page_link appear correct...but they do not lead correctly....
It could be either .htaccess at work or some bit of code in the template that could be doing this.

Please check for the .htaccess yourself and PM the template for me to see :)

Thanks
In your first snippet of code for your folder view -
Code: Select all
<cms:link masterpage='referenzen.php' page=k_page_name />
would be the same as -
Code: Select all
<cms:show k_page_link />


In your second snippet for your page view, I don't understand why you are using the pages tag... You should remove it and see if that fixes the issue.
Hi cheesypoof!

Thanks for the tip. When I remove pages tag it works.

I wanted to use cms:paginator tag and therefore I used cms:pages...but that obviously does not work here....

Any suggestion how to achieve this in the page view?

It seems to me, whatever I use for making this kind of navigation through pages, will require cms:pages and pagination...

Tanja

Just to add, what I have here now:


I have folders each containing images and related line of text

Then, I have 2 list views:

in the home view, I display 3 thumbnails form each folder....

in the folder view, I display all thumbnails from one folder

when one clicks on the thumbnail, one should see the page view of the single item AND have a possibility to have a navigation as one made with paginator, to go through all pages in one particular folder....
Tanja, for 'next' and 'prev' pages in page-view, some solutions are discussed in the following thread - viewtopic.php?f=8&t=7087

You'll want to add folder=k_page_foldername to the cms:pages tag used in the mentioned solutions to constrain the pagination to only current folder.
Hi Kamran,
thanks...
I use now the code with setting variables prev_page and next_page...etc..so to have navigation "Next" and "Prev"...

I tried using k_current_page and k_total pages in this scenario, but I cannot get this to work...

So, could you please tell me, is it correct, that k_current_page and k_total pages can be fetched only if pagination is set for the page-tag? So thay cannot be set in the page view, so to see the current page number out of all pages number?


Tanja
Hi Tanja,

Pagination is something that comes into play when we have a list of pages and need to break it up into manageable chunks.
A page-view is just a single page so, understandably, we cannot use pagination on it.

So, you are right, the k_current_page and k_total pages variables only become available with pagination (and pagination is not available with a page-view).

That said, as shown in the post I pointed you to previously (viewtopic.php?f=8&t=7087), we can 'simulate' a single-page pagination using a bit of PHP. The original code only made available the 'next' and 'prev' links.
I've tweaked it to also provide the current page's position (in the folder) and the total number of pages (in the folder).
Here it is -
Code: Select all
<cms:if k_is_page >
    <h1><cms:show k_page_title /></h1>

    <cms:php>
       global $CTX;
       $page_ids = explode( ",", "<cms:pages folder=k_page_foldername include_subfolders='0' ids_only='1' />" );
       $cur_page_id = "<cms:show k_page_id />";
       $pos = array_search( $cur_page_id, $page_ids );
       if( $pos!==FALSE ){
          $CTX->set( 'k_total_pages', count($page_ids), 'global' ); 
          $CTX->set( 'k_current_page', $pos+1, 'global' ); 
         
          if( $pos>0 ){
             // Prev page id
             $prev_page_id = $page_ids[$pos-1];
             $CTX->set( 'prev_page_id', $prev_page_id, 'global' );
          }
          if( $pos<count($page_ids)-1 ){
             // Next page id
             $next_page_id = $page_ids[$pos+1];
             $CTX->set( 'next_page_id', $next_page_id, 'global' );
          }
       }
    </cms:php>

    <cms:if k_current_page >
        <h4>Showing page <cms:show k_current_page /> of <cms:show k_total_pages /> pages <cms:if k_page_foldername>in folder <cms:show k_page_foldername /></cms:if></h4>
    </cms:if>
   
    <cms:if prev_page_id >
       <cms:pages id=prev_page_id skip_custom_fields='1'>
          <a href="<cms:show k_page_link />">Prev</a>
       </cms:pages>
    </cms:if>
    <cms:if next_page_id >
       <cms:pages id=next_page_id skip_custom_fields='1'>
          &nbsp;<a href="<cms:show k_page_link />">Next</a>
       </cms:pages>
    </cms:if>
   
</cms:if>

It shows something like "Showing page 2 of 17 pages in folder Test"

Hope this is what you wanted.
Please let me know.
Hello Kamran!

yes, that is exactly what I wanted to do in the page view! :P
I had pagination before in the list view, and started to do the same in the page view without thinking , because cms:paginator is such a great tag... but I've got the problem with page links, when cheespoof pointed to the parts of my code above...

Thanks a lot for extending the php , so to include current page and the total number of pages!!!


Tanja
8 posts Page 1 of 1
cron