createdByUserNum and rule to rewrite
5 posts by 3 authors in: Forums > CMS Builder
Last Post: July 19, 2010 (RSS)
By Djulia - July 15, 2010 - edited: July 15, 2010
I would like to use a one rule to rewrite with createdByUserNum :
xxx.php?createdByUserNum=3
xxx.php?createdByUserNum=3&page=2
xxx.php?createdByUserNum=3&page=3
...
For example:
listing.php?"username"-3
listing.php?"username"-3&page=2
listing.php?"username"-3&page=3
…
Did somebody already test ?
Thanks for your suggestions.
Djulia
Re: [Djulia] createdByUserNum and rule to rewrite
By Jason - July 16, 2010
To have CMS Builder do the search for records created by a user automatically, you need to have the "createdByUserName" in the url.
However, you can format the URL string to anything you like, so long as you have the record number (in your example 3) at the end of the url string like this:
xxx.php?page=2&userName-3
This will not do the search automatically, but you can then change your getRecords statement to use this line:
'where' => "createdByUserNum=".getNumberFromEndOfUrl(0),
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] createdByUserNum and rule to rewrite
By Djulia - July 16, 2010
Thank you!
Your solution is good.
But, it would be possible to modify the value of prevPageLink and nextPageLink ?
Currently, I obtain for : user.php?&userName-3
$listingMetaData['nextPageLink'] ==> user.php?userName-3=&page=2
$listingMetaData['prevPageLink'] ==> user.php?userName-3=&page=1
Thanks again. :)
Djulia
Re: [Jason] createdByUserNum and rule to rewrite
By Djulia - July 16, 2010 - edited: July 16, 2010
The post of Dave helped me to find a solution.
http://www.interactivetools.com/forum/gforum.cgi?post=58611#58611
<?php
//
$str = @$_SERVER['REQUEST_URI'];
parse_str($str, $output);
$user = array_keys($output);
$pageLink = "{$user[1]}";
$listingMetaData['prevPageLink'] = "{$_SERVER['PHP_SELF']}?page={$listingMetaData['prevPage']}&{$pageLink}";
$listingMetaData['nextPageLink'] = "{$_SERVER['PHP_SELF']}?page={$listingMetaData['nextPage']}&{$pageLink}";
$listingMetaData['firstPageLink'] = "{$_SERVER['PHP_SELF']}?page=1&{$pageLink}";
$listingMetaData['lastPageLink'] = "{$_SERVER['PHP_SELF']}?page={$listingMetaData['totalPages']}&{$pageLink}";
?>
Thanks to have taken the time to answer me ! :)
Djulia
Re: [Djulia] createdByUserNum and rule to rewrite
By Donna - July 19, 2010
--
support@interactivetools.com