Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 07:20 am EST
Geeklog Forums
URL rewrite + parameters
Status: offline
alb3rt
Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
What I have solved:
Modifying .htaccess
#RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^page/(.*)$ /staticpages/index.php?page=$1 [L,QSA]
But with this, url rewrite does not work with all other parts that are not declared in the .htaccess
D Web Studio - www.d-webstudio.net
Modifying .htaccess
Text Formatted Code
#RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^page/(.*)$ /staticpages/index.php?page=$1 [L,QSA]
But with this, url rewrite does not work with all other parts that are not declared in the .htaccess
D Web Studio - www.d-webstudio.net
19
18
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
>>Is it possible to get parameters using a URL rewrite? I mean:
In what way? In the code the url.class.php figures out the arguments (it is what is being referred to as the variables). COM_setArgNames returns the names for the plugin that uses rewrite.
One of the Geeklog Core Developers.
In what way? In the code the url.class.php figures out the arguments (it is what is being referred to as the variables). COM_setArgNames returns the names for the plugin that uses rewrite.
One of the Geeklog Core Developers.
16
21
Quote
Status: offline
alb3rt
Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
In this case get id page from the url, What I need is to insert an image in the staticpage (using ?page= ), this works for me when I don't use url rewrite.
$page_ID = Geeklog\Input::request('page', '');
But using URL Routing, I can't get $page_ID
D Web Studio - www.d-webstudio.net
Text Formatted Code
my_site/staticpages/index.php?page=PAGE_ID$page_ID = Geeklog\Input::request('page', '');
But using URL Routing, I can't get $page_ID
D Web Studio - www.d-webstudio.net
14
22
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
I don't have my Geeklog development server setup at the moment to test but looking at the code the Static Page plugin supports URL Rewriting and grabs the page variable like this:
COM_setArgNames(array('page', 'disp_mode'));
$page = COM_applyFilter(COM_getArgument('page'));
One of the Geeklog Core Developers.
Text Formatted Code
COM_setArgNames(array('page', 'disp_mode'));
$page = COM_applyFilter(COM_getArgument('page'));
One of the Geeklog Core Developers.
21
13
Quote
Status: offline
alb3rt
Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
Your answer has solved the problem, I create my "carousel" from lib-custom.
function CUSTOM_templateSetVars($templatename, $template)
...
if (COM_onFrontpage()) {
$tid = 'home';
$full = true;
} else {
COM_setArgNames(array('page', 'disp_mode'));
$tid = COM_applyFilter(COM_getArgument('page'));
}
$carousel = DWS_Carousel($tid, $full);
...
switch ($templatename) {
case 'header':
$template->set_var('carousel', $carousel);
break;
...
I avoid touching geeklog core.
Thank you very much!
D Web Studio - www.d-webstudio.net
Text Formatted Code
function CUSTOM_templateSetVars($templatename, $template)
...
if (COM_onFrontpage()) {
$tid = 'home';
$full = true;
} else {
COM_setArgNames(array('page', 'disp_mode'));
$tid = COM_applyFilter(COM_getArgument('page'));
}
$carousel = DWS_Carousel($tid, $full);
...
switch ($templatename) {
case 'header':
$template->set_var('carousel', $carousel);
break;
...
I avoid touching geeklog core.
Thank you very much!
D Web Studio - www.d-webstudio.net
22
25
Quote
All times are EST. The time is now 07:20 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content