Move Position of Pagination Limit Box

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
jethrodesign
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Wed Feb 11, 2009 2:08 am

Move Position of Pagination Limit Box

Post by jethrodesign » Wed Aug 18, 2010 11:42 pm

Hi, I'm trying to change the position of the pagination limit box (displays how many items per page will display) and accompanying text (page x of y) on my default search results pages so that it can align with the actual pagination links. Unfortunately I'm still a bit new to PHP, so I can't quite figure out how to make it happen.

I found the call for the main pagination in the 'default_results.php' file for com_search. But the limit box is called way down underneath the form to Search Again in the 'default_form.php'. Just doesn't make sense for them to be separated.

So I moved the following code from the bottom of the 'default_form.php' file to the 'default_results.php' file next to the call for the main pagination:

Code: Select all

<?php if (count($this->results)) : ?>
<div class="display">
<label for="limit"><?php echo JText :: _('Display Num') ?></label>
	<?php echo $this->pagination->getLimitBox(); ?>
		<?php echo $this->pagination->getPagesCounter(); ?>
	</div>
<?php endif; ?>
This puts it in the right place, and with a quick float:right I'm able to get everything on one line. But the limit drop-down menu no longer functions when it's in this location. I tried putting it in different places and orders, but although it displays fine, it has no affect.

I don't see anything obvious in the form that should affect this. It all has to do with performing a new search.

- Any ideas or other ways to make this happen?

Thanks!

User avatar
Bjorg
Joomla! Ace
Joomla! Ace
Posts: 1557
Joined: Tue Jul 07, 2009 4:45 am

Re: Move Position of Pagination Limit Box

Post by Bjorg » Thu Aug 19, 2010 5:57 am

Tried restoring the modified php file, and utilized CSS instead?

If this can be accomplished, please post URL.

Hope this helps!

jethrodesign
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Wed Feb 11, 2009 2:08 am

Re: Move Position of Pagination Limit Box

Post by jethrodesign » Thu Aug 19, 2010 5:56 pm

Hi, thanks for the reply.

I had considered trying to do it with only CSS, but the elements are by default separated by an entire form with multiple fields. And this form has a border applied to it's top. So I would have to use a huge negative margin to try to get the limit box DIV to move all the way up there. And with the way that different systems render fonts (PC / Mac), there's no way to ensure that they would be perfectly aligned by using an arbitrary number.

I'm just wondering what's causing the functionality to break just by basically moving the element to a different location?

So here's a link ( http://www.socalcollegeaccess.org/compo ... phrase=all ) to a typical search results page the way I would LIKE it to look. But you'll see that the limit box is not working.

Also, and I'm not sure if this is part of the same issue, if you do a search for a more obscure word that has few results, the limit box will still show on the page even if there is no pagination. Is this the default behavior, or is this malfunctioning as well? It would seem to me this element would disappear if there aren't enough items to warrant it.

THANKS AGAIN!

User avatar
Bjorg
Joomla! Ace
Joomla! Ace
Posts: 1557
Joined: Tue Jul 07, 2009 4:45 am

Re: Move Position of Pagination Limit Box

Post by Bjorg » Thu Aug 19, 2010 8:35 pm

The CSS generally moves from left, to right, then out to the right
then down, depending on template design.

To move the text “Start Prev 1 2 Next End” find the following line within the file
“basic_typography.css”:

Code: Select all

DIV#searchpage UL.pagination
Text-align: left;
Depending on template design, one may be able to add a line under these, such as:

Code: Select all

margin-left: 20px;
or

Code: Select all

margin-left: 10%;
Depending on the template design, will decide if pixel(px), or percent (%) is an accepted CSS
function of this template.

For the “Display # 20 Page 1 of 2”, find the following line within the file basic_typography.css:

DIV.display

Code: Select all

margin-bottom: 20px;
and add:

Code: Select all

margin-right: 20px;
or

Code: Select all

margin-right: 20%;
Again, this depends greatly upon template design, as to whether or not the pixel(px)
or the percent(%) is accepted.

By simply increasing the pixel(px), or percent(%) from the desired direction
will allow each of these two to be individually moved, more or less, left or right
within the template (as is this templates design feature).

Hope this helps!

jethrodesign
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Wed Feb 11, 2009 2:08 am

Re: Move Position of Pagination Limit Box

Post by jethrodesign » Thu Aug 19, 2010 9:02 pm

Hi, thanks for the tips. I'm actually pretty strong when it comes to CSS, but appreciate the explanations.

If I were to keep the elements where they were initially in the code, I would probably have to apply a 'float:right' and 'margin-top:-185px' (or so)' to the div.display to try to get it to 'jump above' the search-again form and align with the pagination.

I 'can' do this if necessary, but it's not really elegant and is probably asking for trouble to get it to work properly across different browsers and platforms, due to the way the text renders and sizes in different environments (and therefore would cause the limit box to not be perfectly aligned).

I would MUCH rather try to figure out why the functionality stops working and how that can be addressed, so it can remain styled a bit more traditionally as it is now.

- Any other ideas???

THANKS AGAIN!

User avatar
Bjorg
Joomla! Ace
Joomla! Ace
Posts: 1557
Joined: Tue Jul 07, 2009 4:45 am

Re: Move Position of Pagination Limit Box

Post by Bjorg » Fri Aug 20, 2010 3:41 am

The CSS suggestions, work with the template, from the provided ULR, in reference to centering the text.

If both templates possess identical CSS code, this should provide resolve, unless the desired outcome is misunderstood?

Hope this helps!

clean
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Aug 18, 2010 7:51 am

Re: Move Position of Pagination Limit Box

Post by clean » Fri Aug 20, 2010 6:18 pm

getLimitbox only works within a form. It must be within an HTML form declaration for the onChange event to be triggered.

Try that.

jethrodesign
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Wed Feb 11, 2009 2:08 am

Re: Move Position of Pagination Limit Box

Post by jethrodesign » Fri Aug 20, 2010 6:54 pm

THANK YOU! That's the answer I was looking for.

So could I just wrap it in a 'dummy' form, or does it need to be a more fully functional and submittable form?

User avatar
Bjorg
Joomla! Ace
Joomla! Ace
Posts: 1557
Joined: Tue Jul 07, 2009 4:45 am

Re: Move Position of Pagination Limit Box

Post by Bjorg » Sat Aug 21, 2010 12:28 am

Glad it worked!

clean
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Aug 18, 2010 7:51 am

Re: Move Position of Pagination Limit Box

Post by clean » Sat Aug 21, 2010 5:34 pm

I believe that it will be a functional form that will do the work. This is because you may need to pass the option, task and view as hidden items in the form (I believe) so that when the form is submitted the same page can still be retained. The action of the form may be something like $_SERVER ['REQUEST_URI'] (to return same page).

Just try and let us see what works.

jethrodesign
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Wed Feb 11, 2009 2:08 am

Re: Move Position of Pagination Limit Box

Post by jethrodesign » Fri Sep 03, 2010 1:06 am

Well, I finally got around to trying to implement this fix. I just wrapped the getLimitBox in a simple form.

The trick was figuring out the right action for the form. It had to repost the same search field to bring up the same page. So this is what the action for the form had to be:

Code: Select all

<?php echo $this->escape($this->searchword); ?>
Now it all works like it's supposed to again, but is exactly where I think it SHOULD be on the search page - next to the pagination. Easy to style and get everything lined up properly.

Thanks again for the tip. Not sure if I would have figured out that the form was the issue. Hope this helps someone else.


Locked

Return to “Joomla! 1.5 Coding”