Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

How can I use HTML tags in bot responses?

Help
2007-04-06
2013-04-25
  • Computermar
    Computermar
    2007-04-06

    Hello,

    I want to use HTML tags like <ul></ul> <li> <br> <b></b> in the templates of the bot.
    How can I use this tags?

    If I add this tags I got an XML error while loading the AIML files in the database.
    If I use the &lt;br&gt; instead of <br> I'm able to load the tags in the database without an error,
    but the answer (template) is never been shown (the bot sends nothing if I ask him a question which belongs to the template).

    Thank you in advance for your information.

     
    • Computermar
      Computermar
      2007-04-07

      Hello again,

      I found the solution by myself:
      If you want to use the <br> tag, you simply have to add something like:

      function ct_br(){
      return "<br>";
      }
      in the customtags.php

      And in the aiml file replace the <br> tag with <br></br>

       
    • BeZazz
      BeZazz
      2007-11-26

      i know <br> was used just for an eg. above but wouldn't <br /> work as it is XML?

       
    • Just for users looking for same answers, here is how it worked for me:
      In AIML files I use:
      <br />
      &lt;li>&lt;/li> (only in <template></template> tags, never in <random></random>)
      &lt;ul>&lt;/ul> (only in <template></template> tags, never in <random></random>)
      <li></li> (only in <random></random>)
      Soemtimes, when you need to use bot properties in links or image tags, you need to also use the entities for link open tags (or both open and close).
      E.g.
      <a href="somelink.htm"> link text </a>
      <img src="somelink.jpg"/>
      but
      &lt;a href="somelink.php<bot name="website"/>"&gt; link text &lt;/a&gt;
      &lt;img src="<bot name="website"/>somelink.jpg"/&gt;

      Sometimes, I had to also use the htmlentite for & (ampersand) like:
      &amp;lt;img src="<bot name="website"/>somelink.jpg"/&amp;gt;

      The loading script will tell you when a tag is wrong (XML Error > tag needed on line nnn). Then you need to play and choose the best tag format.

      Hope this helps!
      Ciprian M.