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

whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
edited December 2011 in Vanilla 2.0 - 2.8

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.

Best Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    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.

  • 422422 Developer MVP
    Answer ✓

    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.

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    Holy eff @422 I've never heard of the base tag! I think that's a feature that may have to go into core.

Answers

  • sahotataransahotataran Developer, Bay Area - CA ✭✭✭

    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.

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    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.

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
    edited December 2011

    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.

  • 422422 Developer MVP
    Answer ✓

    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.

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    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.

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    Holy eff @422 I've never heard of the base tag! I think that's a feature that may have to go into core.

  • 422422 Developer MVP

    @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.

Sign In or Register to comment.