Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-27-2016, 10:58 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
FounderSim is on a distinguished road
Default Pagination Help..

I am having trouble getting the pagination class to work in class_profile.php

I have the following code:

Code:
		$total = $mysidia->db->select(DUMMY_TEXT")->rowCount();
		
		if($total > 0)
		{
			
			
			$pagination = new Pagination($total, 10, "profile/view/{$mysidia->input->get("user")}");
			$pagination->setPage($mysidia->input->get("page"));	
///query loop result
$stmt = $mysidia->db->select("dummy_table", array("fieldID"), "DUMMY_QUERY ORDER BY fieldID LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
$document->addLangvar($pagination->showPage());
                 }
It shows the text:

It navigates the to the page; url = www.dummyurl.com/profile/view/siminator/page-5

I can't fetch page #5 for some reason =0... Any ideas.
__________________
Reply With Quote
  #2  
Old 02-29-2016, 03:36 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
FounderSim is on a distinguished road
Default

Nobody has any ideas?
__________________
Reply With Quote
  #3  
Old 02-29-2016, 08:57 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,481
Kyttias is on a distinguished road
Default

I don't know how to use the pagination class, sorry. =/ I'd love to have it work on the profiles, too. I ended up using an iframe and I hate my solution.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #4  
Old 03-01-2016, 08:53 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
FounderSim is on a distinguished road
Default

It seems like the problem lies in the class_input.php file

In class_userprofile.php I got this line

Code:
$mysidia->input->get("page")
In the class_input.php file I got this:

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 = ""){
		echo $key;
        if(empty($key) and $this->get instanceof HashMap)
		{
			return $this->get;
		}			
		else
		{
		echo ' =  ' . $this->get->get(new String($key)) . "<BR>";
		return $this->get->get(new String($key));
		}
    }

Output:
Quote:
frontcontroller = index
appcontroller = profile
user = siminator
frontcontroller = index
appcontroller = profile
appcontroller = profile
appcontroller = profile
frontcontroller = index
appcontroller = profile
user = siminator
user = siminator
user = siminator
user = siminator
user = siminator
user = siminator
user = siminator
user = siminator
user = siminator
page =
user = siminator
frontcontroller = index
appcontroller = profile
@Hall of Famer

Page is always blank... I must be missing something.
__________________
Reply With Quote
  #5  
Old 03-02-2016, 09:21 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
FounderSim is on a distinguished road
Default

I guess I am going to try a little work-a-round. Going to add a line or two to mod-rewrite.

Will keep ya'll posted especially you @kyttias
__________________
Reply With Quote
  #6  
Old 03-03-2016, 09:33 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
FounderSim is on a distinguished road
Default

I came up with a workable solution without I-frames or mod rewritting. Not much code needed. Here it is for profile pages:

The first three lines are just incase a user has a name with "page-" in it. It would totally screw up the script.
Code:
		$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']);
			$pageNum = str_replace("/", "", $newStr); 
die($pageNum); //shows page # 

		}
__________________
Reply With Quote
  #7  
Old 03-04-2016, 01:19 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,481
Kyttias is on a distinguished road
Default

Hmm... so what are all the steps we need to go through?

It'd be awesome if you could post your findings as an actual mod!
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #8  
Old 03-05-2016, 02:10 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
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
  #9  
Old 03-05-2016, 10:17 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,481
Kyttias is on a distinguished road
Default

Where should this code go inside what file? I'm still not clear on how to use this information to paginate the user pets on the profile.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #10  
Old 03-05-2016, 11:08 AM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,595
FounderSim is on a distinguished road
Default

Quote:
Originally Posted by Kyttias View Post
Where should this code go inside what file? I'm still not clear on how to use this information to paginate the user pets on the profile.
It will go inside class_userprofile.php somewhere. I modified the file heavily so not sure what the original file looks like anymore. =}
__________________
Reply With Quote
Reply


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 02:17 PM.

Currently Active Users: 9906 (0 members and 9906 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636