Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How do I output a friendly url.

VazVaz New
edited November 2007 in Vanilla 1.0 Help
Hi guys, I'm trying to put a little text box in every post which will have the linkback url inside it. I'd like the url to be static (friendly url). How can I make it so it echoes the friendly version of the posts url and not normal url. Kind regards, Vaz

Comments

  • Leave out the redundant apostrophes to start with! pic
  • VazVaz New
    edited November 2007
    image
  • Hi,
    sorry, I'm not sure to understand, do you want to make some kind of Comment Links?
  • Hi Grahack,
    I'm actually trying to achieve something like this:
    image
  • discussion.php template file uses
    GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '#Item_1', CleanupString($Discussion->Name).'/')
    to build the url of the first post, maybe it will inspire you...
  • VazVaz New
    edited November 2007
    Thanks for that Grahack.

    I'm trying to make an addon. I've keep getting the following however:
    Fatal error: Using $this when not in object context in


    Is $this valid when being used in an addon?

    I also tried using:
    $this->Context->Configuration['BASE_URL'] .'?CommentID='. $Comment->CommentID;
    & removing the ->Context bit
    and got the same result.
  • edited November 2007
    $this can only be used from inside a class. It can be used for an addon, but only if you define a class. $this, if used inside a class MyNeatClass, will then refer to the object created according to MyNeatClass (using new MyNeatClass()) itself.
    $Context object is accessible from your default.php file.
    for some more (and clearer) informations about object oriented programming...
  • Add a line of code to get that value and put it in a variable:
    $baseurl = $Context->Configuration['BASE_URL'];
This discussion has been closed.