1
3lr0n
navigational dropdown list
  • 2006/8/13 19:21

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


Hi, im using XOOPS 2.0.14 and smartsection 2.1 and i was wondering if i can use the navigational dropdown list feature of the pagenav XOOPS class but using names instead of numbers. Im think of use something like pagebreak=name1 or pagebreak name=name1. So i generate a dropdown menu with names.

try to explain.

The code of item.php of /modules/smartsection create an instance of the object pagenav like this
if ($itemObj->pagescount() > 0) {
    include_once 
XOOPS_ROOT_PATH.'/class/pagenav.php';
    if (
$item_page_id == -1) ($item_page_id 0);
    
$pagenav = new XoopsPageNav($itemObj->pagescount(), 1$item_page_id'page''itemid=' $itemObj->itemid());
    
$xoopsTpl->assign('pagenav'$pagenav->renderNav());
}


To show the navigational numbers of pagination uses the rendernav function

$xoopsTpl->assign('pagenav'$pagenav->renderNav());


I check the pagenav class under /class/pagenav and see this method inside the class

function renderSelect($showbutton false)
    {
        if ( 
$this->total $this->perpage ) {
            return;
        }
        
$total_pages ceil($this->total $this->perpage);
        
$ret '';
        if ( 
$total_pages ) {
               
$ret '';
            
$ret .= '';
            
$counter 1;
            
$current_page intval(floor(($this->current $this->perpage) / $this->perpage));
            while ( 
$counter <= $total_pages ) {
                if ( 
$counter == $current_page ) {
                    
$ret .= '.$this->url.(($counter 1) * $this->perpage).'" selected="selected">'.$counter.'';
                } else {
                    
$ret .= '.$this->url.(($counter 1) * $this->perpage).'">'.$counter.'';
                }
                
$counter++;
            }
            
$ret .= '';
            if (
$showbutton) {
                
$ret .= ._GO.'" />';
            }
            
$ret .= '';
        }
        return 
$ret;
    }


So to use the dropdown only have to chage this line on item.php

$xoopsTpl->assign('pagenav'$pagenav->[b]renderSelect()[/b]);


to use this function of the pagenav class.

But i want to generate a select box with names!

This code generates a dropdown with numbers..
But i want to generate a select box with names!
(example: 1.- Introduction, 2.- First Impression.. etc)

but dont know how the xoopscode "pagebrek" works so i dont know how to try to write some code to capture those pagebreaks names and generate the dropdown.

Ta in advance
Spanish Overclocking Community xoops based site : http://www.overclocking.es

2
jensclas
Re: navigational dropdown list

perhaps the module called multimenu will do the trick for you. You can get it at edit - sorry wrnig site - see post #4

3
3lr0n
Re: navigational dropdown list
  • 2006/8/13 20:15

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


i cant find any multimenu module there.. do u mean multilanguaje?
Spanish Overclocking Community xoops based site : http://www.overclocking.es

4
jensclas
Re: navigational dropdown list

woops...must have lefy my brain in bed...hang on...

Ok try this latest version is in the last comment

Comes from this website and a search here will bring up some 'how to's' in english.

5
3lr0n
Re: navigational dropdown list
  • 2006/8/13 20:36

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


Ta for quick replay.. but 2 questions..

1. why multimenu can help me to guess my "problem"?
2.- Where i can find those how to docs? the page seems to be in french (think so.. :)) and its refered to furniture?..

ta in advance
Spanish Overclocking Community xoops based site : http://www.overclocking.es

6
jensclas
Re: navigational dropdown list

I suggested multimenu to give you a drop down menu without doing the work yourself...Sorry if you thought it would help solve your problem I misunderstood you.

The help you can search for I meant here on xoops.org - lots of people using multimenu for the first time have asked questions about it in the forums here at this site.

7
3lr0n
Re: navigational dropdown list
  • 2006/8/13 20:53

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


jensclas.. help is always appreciated no matter if its misunderstood or not...

I try explain a little bit..

Dont want a dropdown menu.. XOOPS have this method on pagenav class, the fact its smartsection (i think all the modules that uses pagination) uses this piece of code to know how many pages does an article have

explode('[pagebreak]'$body);


In this case $body is the variable that contains the full text of a smartsection article. Explode searchs for the separator (pagebreak) in the $body data and returns a number.. this is the number of pages.

Ok.. what i want is to use pagebreak but naming each one with pagebreak name1 or pagebreak name=name1 and how to code this so i can pass the data to pagenav class renderSelect function and build the select with those names.

No matter if i have to write the code.. but dont know php enough to find a function that can search for the pagebreaks, look at the name of EACH ONE, and pass those names.

Thats all
Spanish Overclocking Community xoops based site : http://www.overclocking.es

8
jensclas
Re: navigational dropdown list

Ok...you need the help of a coder - i know less than you about php

9
stefan88
Re: navigational dropdown list
  • 2006/8/13 21:40

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi,

I don't think you will be able to do it without rewriting (hacking) XOOPS pagenav class.

In pagenav.php there is:

while ( $counter <= $total_pages ) {
  if ( 
$counter == $current_page ) {
    
$ret .= '.$this->url.(($counter 1) * $this->perpage).'"selected="selected">'.$counter.'';
  } else {
    
$ret .= '.$this->url.(($counter 1) * $this->perpage).'">'.$counter.'';
                }


The text in drop down is $counter in this part ">'.$counter.'', which is only a number...
..

10
3lr0n
Re: navigational dropdown list
  • 2006/8/13 21:56

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


Yes im planning to write a new fuction on this class.

i think i cant use pagebreak name1 or pagebreak name=name1 cause the explode makes an array with each page but without the separator (in this case pagebreak). I was thinking about a new bbcode like [name]..[/name] that will be translated into a title format in myts and use those tags to set the name of the page. So i need a function to search on each body_part (explode results) for those tags and return the string to build the dropdown menu.

Any ideas about this fucntion?
Spanish Overclocking Community xoops based site : http://www.overclocking.es

Login

Who's Online

339 user(s) are online (269 user(s) are browsing Support Forums)


Members: 0


Guests: 339


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits