![]() |
|
#1
|
|||
|
|||
|
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 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.
__________________
|
|
#2
|
|||
|
|||
|
Nobody has any ideas?
__________________
|
|
#3
|
||||
|
||||
|
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. |
|
#4
|
|||
|
|||
|
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")
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:
Page is always blank... I must be missing something.
__________________
|
|
#5
|
|||
|
|||
|
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
__________________
|
|
#6
|
|||
|
|||
|
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 #
}
__________________
|
|
#7
|
||||
|
||||
|
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. |
|
#8
|
|||
|
|||
|
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
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));
}
}
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 #
Code:
$lenn = strlen($strz); Code:
if(strpos($_SERVER['REQUEST_URI'] ,"page-") == $lenn) Code:
$newStr = str_replace($strz . "page-", "", $_SERVER['REQUEST_URI']); 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());
__________________
|
|
#9
|
||||
|
||||
|
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. |
|
#10
|
|||
|
|||
|
It will go inside class_userprofile.php somewhere. I modified the file heavily so not sure what the original file looks like anymore. =}
__________________
|
![]() |
|
|
What's New? |
What's Hot? |
What's Popular? |