EDIT My question is how to make pagination on View generic, currently what i have to do is some what like this on every page where i need pagination variables set
<?php echo ( count($this->paginator) > 0 ) ? $this->paginationControl($this->paginator, 'Sliding', 'administration/pager.phtml', array('url' => $this->url('company'))) : ""; ?>
Dear which you want to do is clearly mentioned in zf2 documentation:
http://framework.zend.com/manual/2.1/en/tutorials/tutorial.pagination.html
"Let’s create the partail in the module/Application/view/partial/ folder, so that we can use the control in all our modules:"
Above mention line shows that if we want to make pagination generic which will be available for all module, then make it partial in Application module.
Related
I would like to load pagination module on different module than article. I have found that
components\com_content\views\article\tmpl\default.php contains this:
<?php
if (!empty($this->item->pagination) && $this->item->pagination && $this->item->paginationposition && !$this->item->paginationrelative):
echo $this->item->pagination;
?>
<?php endif; ?>
unfortunately if I put this code for example to my template index file it does not work. Aparently I have to add something more to this.
Could you advice me what other part of the code is needed?
Thank you!
It's a little complicated to wrap your mind around but if you look in the plugins/content folder you will see the pagenavigation plugin. This is the plugin that creates the pagination you see in articles.
THis plugin is triggered by
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$item->params, $offset));
which you can find in `\components\com_content\views\article (and also archive and the tag view of com_tags). I have no idea why it's not triggered in other components except at some point probably someone thought there wasn't a usecase for it.
To trigger the plugin in another component you would need to add that same event or a different event that basically does what the onContentBeforeDisplay method in the plugin does. If it is your own component I would do it in the same place content and tags do. If you need it in one of the core components you could probably do it by using another event.
I'm going crazy with this one. I am trying to change a little bit the pagination style and layout in Joomla. So, I found this file: libraries\joomla\html\pagination.php but I know that pagination is overridden by this file: templates\gk_yourshop\html\pagination.php. Yet, if I modify something in gk_yourshop\html\pagination.php, I can't see the change in the pages. Does joomla cache templates and I have to re-load them (like phpBB)?. I don't understand.
I tried to check if writePagesLinks is called from joomla\html\pagination.php with this:
function getPagesLinks()
{
echo "test";
global $mainframe;
and I can't see the message. I also did this in the other pagination.php file and it's just like I can delete them and it doesn't matter. Can you help me? Thanks!
Looks like I changed it here some time ago:
\libraries\joomla\html\pagination.php
But, that is system file, so i just make a "hotfix" of it.
In Joomla 3.x you can create pagination override from Extensions > Templates > Default Template > Create Overrides > Layouts > Pagination.
The override files are created in "Default Template" "html\layouts\joomla\pagination" folder.
You can edit the override files as per your needs.
Where are you getting WritePageLinks from? That's not one of the supported methods.
http://docs.joomla.org/Understanding_Output_Overrides#Pagination_Links_Overrides
There are four functions that can be used:
pagination_list_footer
This function is responsible for showing the select list for the
number of items to display per page.
pagination_list_render
This function is responsible for showing the list of page number links
as well at the Start, End, Previous and Next links.
pagination_item_active
This function displays the links to other page numbers other than the
"current" page.
pagination_item_inactive
This function displays the current page number, usually not
hyperlinked.
[edit]
You may also want to look at Protostar as an example.
I am a noob in Zend and I would appreciate if you could help me to figure out how to use pagination in my case.
this is my view
and this is my controller
I am using APIs to access my models.
I researched and read a lot about pagination in Zend but I had/have trouble implementing it.
Thank you for your willingness to help me out.
in your controller in line 36 write : (assuming $resultq is a valid zend_paginator param)
$paginator = Zend_Paginator::factory($resultq);
$paginator->setCurrentPageNumber($this->getRequest()->getParam('page')); // page number
$paginator->setItemCountPerPage(20); // number of items to show per page
$this->view->paginator= $paginator;
now in your view you have to add pagination controls, either do it directly in the view or use a template (you can store templates in application/views/scripts/templates for example), here is an example of a pagination template : http://zendgeek.blogspot.com/2009/07/zend-pagination-example.html
then in your view you have to integrate the template (wherever you want the controls to appear) using:
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'templates/pagination.phtml'); ?>
and instead of using <?php foreach ($this->basicBwDetails as $result): ?> use <?php foreach ($this->paginator as $result): ?>
I used Joomla 1.5 for a site that I developed for a gaming company. Part of the site consists of a character generater for the game that they developed. The issue is that users want to be able to print the character sheets off, without having the Joomla template surrounding it.
As for the specifics, I have the directphp extension installed, and the entire generator is written in PHP (with a little JavaScript to handle things that PHP can't). As the generator spans several dozen page calls, it made sense to store everything in $_SESSION. All of this works correctly. In an attempt to make the final sheet printer friendly, I tried redirecting the user to a page outside of Joomla (though on the same server, and even within the same folder) but I cannot access the $_SESSION data from this new page.
I have seen several posts (a few on this site) that point to loading the Joomla Framework and accessing it that way, which I have tried, but the data that I was looking for does not appear to be contained there. Has anyone come across this problem before, or know how to get to that data?
You are making this WAY harder than it needs to be. You don't have to write any additional code to accomplish what you are trying to do. In order to print our the component output without all of the Joomla template, you just append ?tmpl=component to your URLs and Joomla will display only to component output without any of the template. If you want to give it a custom stylesheet or anything special, you can also add in a template override by adding a file named component.php in your template folder.
In order to control the CSS per page, you can add Page Class Suffixes in the menu items. Then add this code to index.php so you can use them.
Somewhere in the head add this:
$menu = &JSite::getMenu();
$active = $menu->getActive();
$pageclass = "";
if (is_object( $active )) :
$params = new JParameter( $active->params );
$pageclass = trim($params->get( 'pageclass_sfx' ));
endif;
Replace your body tag with this:
<body id="<?php echo $pageclass ? $pageclass : 'default'; ?>">
Any page that you do not specific a Page Class Suffix for will use default as the body ID, any that you do will use what ever you specify.
I have created my own extension and modules. I can view the modules fine, by going to their URL. However, now I want to embed them on a page, much like a content class. How do I go about doing that?
Thanks!
You have to create template operator or function and use them in template.
It is not possible to "embed" a module in a page except if the module which is called do it at the PHP level.
For instance, it's possible to write this :
$module = eZModule::findModule( 'content' );
$result = $module->run( 'history', array( 1 ) );
But if you want to display anything related to your module, you should declare that your extension contains some templates and override some templates.
Let's say that you would like to make your own register module.
Step 1, you may have to add this in your_extension/settings/design.ini.append.php :
[ExtensionSettings]
DesignExtensions[]=your_extension
So you are now able to add your own user/register.tpl
This template contains a form like this :
<form action={'/user/register'|ezurl}...
So you just need to copy the template but with :
<form action={'/your_module/register'|ezurl}...
Now let's say that your template is supposed to display some informations related to your module. You may have to define some fetch functions so you would be able to write something like this:
{def $nb = fetch('your_module','beta_accounts')}
<h2>Hurry up! There are only {$nb|wash} available accounts for free!</h2>
<form action={'/your_module/register'|ezurl} method="POST">
...
</form>
I hope that it will help...