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

How to retrive the content of h1 in {asset name="Content"}

Hello,

I need to extract the title of the h1 in {asset name="Content"} for displayed to another place.

What is the best solution ?

Is it possible to extract with a regular expression ?

Thank you in advance !

PS: I know it possible with jQuery but I would avoid.

Comments

  • Options
    peregrineperegrine MVP
    edited October 2015

    too general to answer. need some specifics.

    in the before render events and various other events you can retrieve.

    var_dump($Sender->Data['Title']);

    or via

    var_dump(Gdn::Controller()->Data('Title'));

    and stash it away if you like.

    but your question is so general and non-specific it is impossible to answer.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Thank for your help.
    I am working with master.tpl in my theme and for an example:

    {$title}

    {asset name="Content"}

    I want to display the h1 tag out of the asset "Content" ($title variable dosen't exist)

    Is it more clear for you ?

  • Options
    peregrineperegrine MVP
    edited October 2015

    I want to display the h1 tag out of the asset "Content" ($title variable dosen't exist)

    true $title does not exist ....

    but {$Title} does exist.

    you can find all the variables with

    {debug}

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    ClémentClément
    edited October 2015

    Thank you so much !!! O.o

    The debug variable is really convenient !

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    peregrine IS a living debug variable :D

Sign In or Register to comment.