Jump to content

Pagination Helper In Module


Blesta Addons

Recommended Posts

I have successufully added the pagination helper to a module . The only probleme i have is that the pagination UL tag has a class that i don't know from where is comming !

<ul class="pagination pagination-sm">.... </ul>

Any idea for this ?

Note i use the same code in plugins and is not generating a class for the UL Tag.

Link to comment
Share on other sites

Naja7host, please explain better the problem: do you want know more about css class (eg php class that generated the html with css class?

the pagination class inluded in blesta generat the build links by $this->Pagination->build(); in normal mode the generated code something like :

<div class="pagination">

<ul>

<li class=" disabled"><a class="ajax" href="/blesta/admin/clients/index/active/1/?sort=id_code&order=desc">← First</a></li>

<li class=" disabled"><a class="ajax" href="/blesta/admin/clients/index/active/1/?sort=id_code&order=desc">Prev</a></li>

<li class="active"><a class="ajax" href="/blesta/admin/clients/index/active/1/?sort=id_code&order=desc">1</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/2/?sort=id_code&order=desc">2</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/3/?sort=id_code&order=desc">3</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/4/?sort=id_code&order=desc">4</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/5/?sort=id_code&order=desc">5</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/2/?sort=id_code&order=desc">Next</a></li>

<li class="next"><a class="ajax" href="/blesta/admin/clients/index/active/104/?sort=id_code&order=desc">Last →</a></li>

</ul>

</div>

the same code used in my module , the generated code is :

<div class="pagination">

<ul class="pagination pagination-sm">

<li class=" disabled"><a class="ajax" href="/blesta/admin/clients/index/active/1/?sort=id_code&order=desc">← First</a></li>

<li class=" disabled"><a class="ajax" href="/blesta/admin/clients/index/active/1/?sort=id_code&order=desc">Prev</a></li>

<li class="active"><a class="ajax" href="/blesta/admin/clients/index/active/1/?sort=id_code&order=desc">1</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/2/?sort=id_code&order=desc">2</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/3/?sort=id_code&order=desc">3</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/4/?sort=id_code&order=desc">4</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/5/?sort=id_code&order=desc">5</a></li>

<li><a class="ajax" href="/blesta/admin/clients/index/active/2/?sort=id_code&order=desc">Next</a></li>

<li class="next"><a class="ajax" href="/blesta/admin/clients/index/active/104/?sort=id_code&order=desc">Last →</a></li>

</ul>

</div>

as you see the only deffirence is the class added to the UL tag .

<ul class="pagination pagination-sm">

my question from where this class is comming and why ? how blesta checkthe attribute of the html tags in pagination ?

NOTE : this is note a big probleme, is only a design matter here .

Link to comment
Share on other sites

For pagination, Blesta use "pagination" helper (helper/paginations/pagination.php) with its default config, replaced by Blesta configurations (config/blesta.php): in this last file you can find ul class "pagination pagination-sm" as navigation' >

'surround' > 'attributes' > 'class' for pagination in client view only.
Link to comment
Share on other sites

The class is defined in the "Blesta.pagination_client" settings you are using. You want to override those settings to set the class.

 

e.g.

// Overwrite default pagination settings
$settings = array_merge(Configure::get("Blesta.pagination"), array(
		'total_results' => $total_results,
		'uri'=>$this->base_uri . "/[p]/",
		'params'=>$params,
		'navigation'=>array('surround' => array('attributes' => array('class' => "pagination pagination-sm")))
	)
);
Link to comment
Share on other sites

Addendum: ul with class "pagination" is a standard definition for the Bootstrap component (http://getbootstrap.com/components/#pagination); this depends by the Blesta's porting to bootstrap, but i don't know why in the modules Blesta use "Blesta.pagination_client" as settings.

:huh:

good found daniello .....

 

The class is defined in the "Blesta.pagination_client" settings you are using. You want to override those settings to set the class.

 

e.g.

// Overwrite default pagination settings
$settings = array_merge(Configure::get("Blesta.pagination"), array(
		'total_results' => $total_results,
		'uri'=>$this->base_uri . "/[p]/",
		'params'=>$params,
		'navigation'=>array('surround' => array('attributes' => array('class' => "pagination pagination-sm")))
	)
);

the question here tyson is

why in the modules Blesta use "Blesta.pagination_client" as settings instead of Blesta.pagination ?

note my code in a module tab for admin , is this a bug ?

EDIT , when i ovveride the setting with the cody code, the pagination has no prelink first and prev links .

picture here http://host-image.net/v.php?id=33450pagination.png

i almost sur now is a bug .

Link to comment
Share on other sites

i have fixed this issue , this was my mistake , i'm using Blesta.pagination_client in the admin tab also . so i have fixed this issue with using Blesta.pagination .

now in the client side , the first page of pagination show correctly , but when i click page 2 , it load the full column to the box "panel_content"

<div class="col-md-3">...</div>

<div class="col-md-9">...</div>

so i get the left nav loaded also . i will make more reseach for this .

@Tyson , is this related to "$this->get['whole_widget']" ?

if yes how i can handel the pagination inthe clientg side section in module , i don't see any module yet using it until now .

Link to comment
Share on other sites

i found the probleme , the probleme is coming from the client_services_manage.pdt in client template .

the $tabs is outside the WidgetClient , for this reason , in ajax request it put the whole pdt file inside the WidgetClient .

i think this should not be from the begin be as this . normally the $tabs and $tab_view should be all inside the rendered widget , like the admin side .

the normal code should be something like

			<?php
			echo $this->Html->ifSet($message);
			
			$this->WidgetClient->clear();
			
			$this->WidgetClient->create($this->_("ClientServices.manage.boxtitle_manage", true, $this->Html->ifSet($package->name), $this->Html->ifSet($service->name)), array('id'=>"client_services_manage"), $this->Html->ifSet($render_section, null));
			$this->WidgetClient->startBody();
			?>
			<div class="col-md-3">
				<?php echo $this->Html->ifSet($tabs);?>
			</div>
			<div class="col-md-9">
			<?php			
			if ($this->Html->ifSet($tab_view)) {
				echo $tab_view;
			}
			else {
				echo $this->Html->ifSet($service_infobox);
			}
			?>
			</div>
			<?php
			$this->WidgetClient->endBody();
			$this->WidgetClient->end();
			?>
the same thing for client_services_addons.pdt .

just it need some tweaks of css design to look better .

@Tyson, @Paul , what do you think ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...