Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Here is a simple example of how to use (part of) your Free Nodelet to collect links to nodes, just like the Personal Nodelet can do. Go to Free Nodelet Settings and paste this into your Free Nodelet:

<ul> <!--todo-<li>[id://`id`] </li>--> </ul> [href://?node_id=`id`;op=_freer;at=todo|Add] "`title&`" above.

That HTML comment is a template for how to automatically add text to your Free Nodelet. The link at the bottom triggers this template to be expanded. If you go to node 22609, your Free Nodelet will show a 'Add "tye" above' link. Click it and you'll return to the same node but your Free Nodelet contents will be changed to:

<ul> <li>[id://22609] </li><!--todo-<li>[id://`id`] </li>--> </ul> [href://?node_id=`id`;op=_freer;at=todo|Add] "`title&`" above.

Let's break down how this works. {<!--} starts the HTML comment that contains the template. {todo-} as the first part of the comment gives the template its name, "todo". The {<li>[id://`id`]} and {</li>} are the body of the template, that is, the text that gets expanded and then inserted. {-->} closes the HTML comment and ends the template.

{[href://} starts a link back to PerlMonks. {?node_id=} lets us specify which node ID we want the link to take us to. The {`id`} gets replaced with the current node's ID so that the link takes us back to whatever node we were already at. {;op=_freer} means that clicking the link will run the '_freer' opcode which is what adds stuff to our Free Nodelet. {;at=todo} tells the _freer opcode the name of the template(s) we want expanded. {|Add]} finishes the link and says that the word "Add" is what we'll see and can click on to activate the link.

{"} and {" above.} are just text to be displayed in the nodelet. {`title&`} gets replaced with the title of the current node but with special HTML characters encoded as entities such that the title displays correctly. So what we see in the nodelet looks like:

Add "tye" above.

When we click that link, our browser goes to node 22609 (again) and the _freer opcode gets run. It finds the "todo" template and pulls out the body of it. It expands the {`id`}, replacing it with the current node's ID (22609), and then inserts the resulting expanded template body right before the template in our Free Nodelet's contents.

Then the node gets displayed to the browser with the newly updated Free Nodelet.

- tye        

In reply to Re: Free Nodelet gets templating features (simple "add this" example) by tye
in thread Free Nodelet gets templating features by tye

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (8)
    As of 2018-06-25 16:29 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (127 votes). Check out past polls.