Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 03-05-2016, 02:10 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 11,354
FounderSim is on a distinguished road
Default

Here's an explanation:

In myadopts.php the pagination class uses this to show "pagination"

Code:
$total = $mysidia->db->select("owned_adoptables", array("aid"), "aid {$commandIn} AND owner = '{$mysidia->user->username}'")->rowCount();
			
			
			$pagination = new Pagination($total, 10, "myadopts");
			$pagination->setPage($mysidia->input->get("page"));	//Sets CURRENT PAGE
The error lyes in $mysidia->input->get("page") when used in the userprofile pages, it doesn't work at all. It is always blank.

class input get method used in pagination.

I edited styling. Debugging shown in Post #4.
Code:
/**
     * The get method, returns a user input var stored in Input::$get property.
	 * @param String  $key
     * @access public
     * @return Object
     */
    public function get($key = ""){
        if(empty($key) and $this->get instanceof HashMap)
		{
			return $this->get;
		}			
		else
		{
		return $this->get->get(new String($key));
		}
    }
So using the pagination class wasn't a complete waist. The pagination class is fine, its fetching the page # from $_GET[] that was the issue.

In the class_userprofile.php, I duplicated what the FULL URL should look like without page #'s.

Code:
$strz = $mysidia->path->getTempRoot() . "profile/view/{$mysidia->input->get("user")}/"; //duplicated URL, no page #
stored length of duplicated URL
Code:
$lenn = strlen($strz);
I then checked if page- is next available characters in URL.
Code:
if(strpos($_SERVER['REQUEST_URI'] ,"page-") == $lenn)
If page- is the next available characters in URL. I strip out everything but the # by replacing my duplicated URL and "page-" in the REAL URL with nothing.

Code:
$newStr = str_replace($strz . "page-", "", $_SERVER['REQUEST_URI']);
Since the pagination class is perfectly OK and it was the class INPUT method get, I just plugged my stripped page # from URL into the pagination class to tell the class what page # I was on.

Code:
$pagination->setPage($newStr);

In USE:
Code:
		$newStr = "";
		$strz = $mysidia->path->getTempRoot() . "profile/view/{$mysidia->input->get("user")}/";
		$lenn = strlen($strz);

		if(strpos($_SERVER['REQUEST_URI'] ,"page-") == $lenn)
		{
			$newStr = str_replace($strz . "page-", "", $_SERVER['REQUEST_URI']);
		}

                       //use pagination class. set URL. SET PAGE its on. Show pagination navigation.
			$pagination = new Pagination($total, 10, "profile/view/{$mysidia->input->get("user")}");

			$pagination->setPage($newStr);	

			$document->addLangvar($pagination->showPage());
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:32 PM.

Currently Active Users: 3607 (0 members and 3607 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636