Lord Yggdrasill;11018785 wrote:
Yeah I figured, I am using the server var $_SERVER['DOCUMENT_ROOT'] in place of http://www.domain.com/, which works out nicely.
No, it doesn't work out nicely. Well, it may work under certain conditions, but they relate to two entirely different concepts, not just two different strings. These two on the other hand are two different strings, which both (possibly) represent file paths, (and possibly might be used as such)
$string_one = '/path1/file';
$string_one = '/path2/file';
[/code]
While these two are also two different strings - but not file paths They are in point of fact, URLs
$string_one = 'http://example.com/path1/file';
$string_one = 'http://example.com/path2/file';
Do note that accessing a file path means you HAVE to be on the same machine as the file, or otherwise be able to mount a remote disk locally. This is not done via HTTP, altough I supposed you could write code to do so. Also note that accessing an URL means you need to make a HTTP REQUEST to a WEB SERVER, which is completely different than accessing the local file system, even though both requests MAY end up accessing the same file on the same disk.
And finally note that /path1/file above MAY actually refer to the same file being accessed with http://example.com/path2/file, while /path2/file above MAY actually refer to the same file being accessed by http://example.com/path1/file (and no - there are no variables involved, just plain strings).
Lord Yggdrasill;11018785 wrote:
There is still one more issue with smarty. When I have a variable that contains url to an external site assigned to smarty template, it will generate a blank page too.
Blank pages are caused by pages containing no output. Or serious errors. Or some additional stuff which performs post processing and fails miserably when there are errors.
Lord Yggdrasill;11018785 wrote:
One example is this:
$credits = "Template Designed by <a href = 'http://www.templatedesign.com'> Smarty Template Design Inc</a>";
$smarty->assign("credits", $credits);
Well, if you consider the above a complete example, there is no output. Thus, if you get a blank page, it's working as expected. However, if you do output the above into a document served as HTML, ther will be errors.
I'm not certain about how HTML5 would treat "href", but I'm guessing it'd work like any other such construct, which would be equal to href="href", which in turn would take you to the RELATIVE PATH document "href". On the other hand, if I try that in Firefox, it takes me to the document root, so it could be href is allowed under HTML5, and defaults to document root (as in http://example.com/ and NOT as /path/to/docroot/). But I doubt it's actually valid HTML 5.
But I do know that there is no attribute named = and there certainly is no attribute named 'http://www.templatedesign.com'.
Try removing some white spaces and see what happens.
Lord Yggdrasill;11018785 wrote:And in the .tpl file it gives a blank page if I attempt to use this variable {$credit}, the blank page goes away as long as I remove it. Is there a way to help with this?
Smarty ought to ouput whatever you tell it to, as far as I know. But perhaps you have other things, or perhaps it's possible to set up smarty to do additional parsing, and that one or the other stops output when it encounter certain things that are invalid as HTML. But if you copy paste that link into an html page, and then run that page through a validator (http://validator.w3.org), you'd get those errors. Moreover, if you serve the page as XHTML, the href attribute most definitely has to have an explicit value (which possibly may be empty).
But as far as I know smarty, it would NOT care about invalid HTML output. Smarty is supposed to let you output whatever you like and doesn't concern itself with what that output is.