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.

Generating urls in Garden

ddumontddumont ✭✭
edited April 2011 in Vanilla 2.0 - 2.8
Are there utilities for this?

My two examples:
I'd like to get the location of the rss image

But I need a safe way of linking it in case the forum is in a subdirectory... etc...

I also need a safe way of generating a URL to get to a specific post.

Any ideas?

There was an error rendering this rich post.


  • LincLinc Detroit Admin
    Url('/applications/dashboard/design/images/rss.gif') is probably what you want.

    For a link to a discussion, you can simply do Url('/discussion/'.$DiscussionID) or you could do the full Url('/discussion/'.$DiscussionID.'/'.Gdn_Format::Url($DiscussionName))
  • I'll try it out, thanks!

    There was an error rendering this rich post.

  • SS ✭✭
    For images use Asset() not Url(), because Url() with rewrite.urls = off gives you index.php?p=applications/dashboard/design/images/rss.gif

    For urls use Url(). I use Gdn_Format::Clean() for last part.
  • @S can you give an example of using ::clean with URL?

    There was an error rendering this rich post.

  • SS ✭✭
  • Excellent. Thanks.

    Do you know if this is necessary? I think I was copying some core vanilla code that did not use Clean on the discussion name.

    There was an error rendering this rich post.

Sign In or Register to comment.