Shoutbox

html/tpl - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: html/tpl (/showthread.php?tid=83852)

html/tpl by Quantum on 05-21-2008 at 04:45 PM

Well if you look at this code:

<input size="40" id="video_link" name="video_link" type="text" value='/videos.php?id={$video[video].id}'>

You see the /videos.php?id={$video[video].id}

is it possible to put a code infront of it so it adds the website url to it?

I can't seem to understand.

Thanks.


RE: html/tpl by Menthix on 05-21-2008 at 06:14 PM

Sure, but not recommended, makes your site less flexible.

But you can put your site URL in a variable, pass it to the template.

code:
$smarty->assign ("url", http://www.example.com");

And call it.
code:
<input size="40" id="video_link" name="video_link" type="text" value='{url}/videos.php?id={$video[video].id}'>

RE: html/tpl by Quantum on 05-21-2008 at 06:17 PM

quote:
Originally posted by MenthiX
Sure, but not recommended, makes your site less flexible.

But you can put your site URL in a variable, pass it to the template.

    code:$smarty->assign ("url", http://www.example.com");

I mean  so what ever URL the site viewed it is that's what will be added. Is that your code?
RE: html/tpl by Menthix on 05-21-2008 at 06:32 PM

In that case just don't change anything.

Just using /videos.php?id={$video[video].id} will already point users to "example.com/videos.php?id={$video[video].id}" or "somethingelse.example.com/videos.php?id={$video[video].id}" depending on which url your users use to access you site. In most cases there is no reason to prefix the domain in the code.

Maybe i'm not understanding your question?


RE: html/tpl by Quantum on 05-21-2008 at 06:49 PM

I know that will still work but that code output's a URL to a webpage so it can be /videos.php... it will have to be http://example.com/videos.php?...

Understand? :S

Thanks!


RE: html/tpl by Thor on 05-21-2008 at 08:11 PM

quote:
Originally posted by john-t
I know that will still work but that code output's a URL to a webpage so it can be /videos.php... it will have to be http://example.com/videos.php?...

Understand? :S

Thanks!
That's exactly what it would be, unless you wish to redirect the user to a diffrent place. In such an event, MenthiX just told you.
RE: html/tpl by Quantum on 05-21-2008 at 08:30 PM

but i need it to work no matter were its at so i don't have to edit the code and chnage the url..


RE: html/tpl by Menthix on 05-21-2008 at 10:15 PM

Judging by what you pasted it will/should work no matter where it's at without changing any code. If it doesn't, link us to the page where the problem is so we can see what you mean.


RE: html/tpl by Quantum on 05-21-2008 at 10:20 PM

$smarty->assign ("url", http://www.example.com");

Will that code no output http://www.example.com instead of my URL?


RE: html/tpl by Lou on 05-21-2008 at 11:17 PM

quote:
Originally posted by john-t
$smarty->assign ("url", http://www.example.com");

Will that code no output http://www.example.com instead of my URL?
Change it to your url?
RE: html/tpl by foaly on 05-21-2008 at 11:21 PM

I think he means that the url should be the url of the website the code is on... So it doesn't matter on which site you place the code, it will always be the videos.php on the site you are viewing...


RE: html/tpl by WDZ on 05-22-2008 at 01:37 AM

Notice that he's using an <input type="text">, so he probably wants something like this...

[Image: attachment.php?pid=909289]

I'd post some code, but I refuse to help krissy. |-)


RE: html/tpl by Quantum on 05-22-2008 at 03:06 PM

quote:
Originally posted by foaly
I think he means that the url should be the url of the website the code is on... So it doesn't matter on which site you place the code, it will always be the videos.php on the site you are viewing...

yes. so whatever site its on it will add the site its on URL to it. if i move it to another site it will be that sites url. without changing anycode.

is that possible as it seems the example.com code will only output the smarty http://example.com
RE: html/tpl by MeEtc on 05-22-2008 at 04:03 PM

http://www.php.net/manual/en/reserved.variables.server.php


RE: html/tpl by RaceProUK on 05-23-2008 at 07:28 PM

If you don't want to comb the entire page:
$_SERVER['SERVER_NAME'];

On this forum, that would give shoutbox.menthix.net.
On my site, it would give www.rpsoftware.net.
On your site, it would give your domain name.


RE: html/tpl by MeEtc on 05-23-2008 at 09:53 PM

code:
if(isset($_SERVER['HTTPS']))
   $url='https://';
else
   $url='http://';
$url.=$_SERVER['HTTP_HOST'];
$url.=$_SERVER["SCRIPT_NAME"]
That should return a full URL to the current page