1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Phrase Text - integrate Xen Links

Discussion in 'XenForo Development Discussions' started by eriche, Jan 19, 2015.

  1. eriche

    eriche Member


    I struggle around to integrate in a Phrase links e.g. to Member Profiles and so on.

    I am going to fetch userinformation from the DB - and want to Show a link to "Member_xyz" (which has DB ID 6).

    I tryed following

    <a href="{xen:link 'members',6}">Member_xyz</a>
    as well as

    <a href="{xen:link 'ROUTE'}">TEXT</a>
    <a href="{xen:link account/upgrades}">upgrades</a>
    But I always get the message

    ERROR: Route {xen:link account/upgrades} could not be found. and so on,...

    What do I miss?

  2. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    That's not possible as the xen tags/functions are not rendered in phrases, what you have to do is pass the links as phrase parameters.

    For XF's template:
    {xen:phrase your_phrase_title, 'link={xen:link members, 6}'}
    For PHP code:
    $something = new XenForo_Phrase('your_phrase_title', array('link' => XenForo_Link::buildPublicLink('members'6)));
    And your phrase content should be something like this:
    <a href="{link}">Member_xyz</a>
    P.S. There can be typos, so please double check the code.
    otto and Rob like this.
  3. eriche

    eriche Member

    @Mr. Goodie2Shoes you are Genius!
    I think that I am missing some fundamental Basics - but I don`t have the Feeling this is well documented :censored:
    Where could I read about this?

    It is not 100% working
    doesn`t work like supposed :(

    I get redirected to the Members overview page, but not to a specific Members Profile.
    Is maybe the UserID not correct? Should it be the Username? Or both together?

    Where can I get all the "XenForo_Link" Options listed or explained :sleep:

  4. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    yeah... I thought it wouldn't work :p
    You'll have to pass an array as the build data:
    XenForo_Link::buildPublicLink('members', array('user_id' => 6));
    XF template:
    {xen:link members, {xen:array 'user_id=6'}}
    You can also include the username so that the builder can include it in the URL.
    eriche likes this.
  5. eriche

    eriche Member

    yea! now it is working ;)

    But again, how do I get this knowledge?
    Would Need a list of all XenForo_Link Options (Parameters).

    Next step I Need for sure, is linking to a Topic in PHP via XenForo_Link

  6. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

Share This Page