Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Creating a relative link in defaultmaster.tpl
whu606
MVP
I have a swf banner I want to use on my theme.
The swf file is in my theme's views folder.
If I make an absolute reference the swf file loads fine, but I can't work out how to make it relative.
I've tried snow.swf, views/snow.swf and /views/snow.swf
Can someone point me in the right direction please?
Thanks.
Tagged:
0
Best Answers
-
Todd Vanilla Staff
You want to do this:
{link path="/themes/mytheme/design/snow.swf" notag="1"}
The link function is meant for actual anchors so it's not optimal for theme assets if you don't have friendly urls. We'll have to add a nicer template function for you later.
0 -
422 MVP
Ive always set base href , in other projects. Not hadany luck with this in vanilla, would be a cleaner solution... wouldnt it?
There was an error rendering this rich post.
3
Answers
Relative swfs are hard to load.
I remember in one of my projects In some other framework I tried to load swf by relative path but I was not successful - I had to either put swf in individual directory or I had to put and absolute path to swf
There was an error rendering this rich post.
You want to do this:
The link function is meant for actual anchors so it's not optimal for theme assets if you don't have friendly urls. We'll have to add a nicer template function for you later.
Todd
Thanks for that. It's working now. I'm actually just using the html code
<object width="800" height="120"> <param name="movie" value="themes/whu/views/snow.swf"> <embed src="themes/whu/views/snow.swf" width="800" height="120"> </embed> </object>
but I'm guessing from you answer I could do it another way?
Actually, if you could tell me how that would help.
I've just seen that using that short code doesn't load the movie in the discussion pages, only on the front page.
Ive always set base href , in other projects. Not hadany luck with this in vanilla, would be a cleaner solution... wouldnt it?
There was an error rendering this rich post.
Thanks (again!) for that, 422.
I didn't know about the base href tag.
That seems to be delivering my swf on each page now.
Holy eff @422 I've never heard of the base tag! I think that's a feature that may have to go into core.
@Todd My son is a top php programmer with a worldwide travel company. He has always used the base href method, as it localises all url routes.
He has some very neat tricks for custom headers to, using a title tagging system, we use on our main site. Its very clean. I had tried utilising it within vanilla before, but had url collisions.
Hope it can be used, as themeing then will become a breeze
There was an error rendering this rich post.
Put the full URL http://mywebsite.tld/themes/whu/views/snow.swf that way you know it will work.