Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Where do u set your URL's?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
okidoki_howie
Smarty Rookie


Joined: 16 May 2003
Posts: 8

PostPosted: Thu Jun 12, 2003 4:18 am    Post subject: Where do u set your URL's? Reply with quote

^, in the .php scripts or the .tpl templates?

I have long long long urls because of all the name value pair attibutes (but who doesn't=).

I've tried both ways. When i define/set them in the smarty templates they look incredible long and difficult to read. When i set them in the php scripts, it's a bit more easier since i use some custom function but then i have to pass the entire array of urls when the only difference between them may be one value (ex. category id).

To me, it seems more logical to define the urls in the templates since the responsibility is leaned towards the web designer and not the programmer.

What about you guys? Or is there a easier trick i can use?
Back to top
View user's profile Send private message
sweatje
Smarty Regular


Joined: 17 Apr 2003
Posts: 70
Location: Bettendorf, Iowa, USA

PostPosted: Thu Jun 12, 2003 11:27 am    Post subject: Reply with quote

I usually send a tag for the base URL, and append as nescesarry. For situation where I know I will be having many vars that need to be updated and output every time, I will write a custom function.

HTH
_________________
Jason
jsweat_php AT yahoo DOT com
Back to top
View user's profile Send private message
okidoki_howie
Smarty Rookie


Joined: 16 May 2003
Posts: 8

PostPosted: Thu Jun 12, 2003 7:35 pm    Post subject: Reply with quote

sweatje wrote:
I usually send a tag for the base URL, and append as nescesarry. For situation where I know I will be having many vars that need to be updated and output every time, I will write a custom function.

HTH


ic... Thanks for the response sweatje. Can you tell me more about the custom function, exactly what does it do? Your talkin about a function in php and not in smarty rite?
Back to top
View user's profile Send private message
sweatje
Smarty Regular


Joined: 17 Apr 2003
Posts: 70
Location: Bettendorf, Iowa, USA

PostPosted: Thu Jun 12, 2003 7:39 pm    Post subject: Reply with quote

[php:1:a1fd7512a7]<?php
$smarty->register_function('appl_url', 'smarty_appl_url');

/**
* function to write an application url
*
* makes the assumption that anything not explicitly overridden should remain the default
* @return void
*/
function smarty_appl_url($paParms, &$poSmarty)
{
global $go_controller;

$a_slice = $go_controller->GetSlices();

if (array_key_exists('view', $paParms)) {
$s_view = $paParms['view'];
} else {
$s_view = $go_controller->GetView();
}

for ($i=1; $i<4; $i++) {
$s_idx = 'c'.$i;
$s_var = 's_'.$s_idx;
$$s_var = "&$s_idx=";
if (array_key_exists($s_idx, $paParms)) {
$$s_var .= $paParms[$s_idx];
} else {
$$s_var .= $a_slice[$s_idx];
}
$s_idx = 'v'.$i;
$s_var = 's_'.$s_idx;
$$s_var = "&$s_idx=";
if (array_key_exists($s_idx, $paParms)) {
$$s_var .= $paParms[$s_idx];
} else {
$$s_var .= $a_slice[$s_idx];
}
}

//some year stuff later

print APPL_BASE.$s_view.$s_c1.$s_v1.$s_c2.$s_v2.$s_c3.$s_v3;
}
?>[/php:1:a1fd7512a7]
_________________
Jason
jsweat_php AT yahoo DOT com
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP