NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: springguy on October 10, 2012, 05:36:57 PM

Title: Dynamic XHTML insertion in NetWebPage
Post by: springguy on October 10, 2012, 05:36:57 PM
NetTalk 6.42

I have a NetWebPage that I have been using with XHTML to incorporate a series of image Tiles with clickable links.  Works fine.

Now, I want to expand that capability by dynamically looking up the appropriate image tile and XHTML from a database rather than having it hard coded in the XHTML tab. 

I'll be looking up each image tile as a separate item from the database based on some selection coding, but once I have the appropriate record with the xHTML, how do I incorporate the xHTML into the page?  Embed point?

Thanks,
Mike  Springer
Title: Re: Dynamic XHTML insertion in NetWebPage
Post by: Bruce on October 11, 2012, 01:36:25 AM
Hi Mike,

right click on the NetWebPage and choose "Source".
then you'll be able to see all the generated code, and the context.

Embedding then becomes a lot easier (simply embed "near" the xHtml generated bits.)

Cheers
Bruce
Title: Re: Dynamic XHTML insertion in NetWebPage
Post by: springguy on October 12, 2012, 04:21:52 AM
Thanks Bruce,
That was your typical wise advice.  I followed it and created my own routine that builds the packet with the desired xHTML from a database record.  That logic is pretty straight forward. 

But, I looked at the packet info that the template generates for xHTML that was added in the template and I see that you manipulate the xHTML.  For example, you add < in front of any < characters (like <<div id> whereas the xHTML is <div id>.  Also, you add <13,10> at the end of every line.

What I'm wondering is can I call a NT routine that does that modification to a line of xHTML (I could not find one), or do I have to write my own routine to mimic the changes that the template generates?

Mike
Title: Re: Dynamic XHTML insertion in NetWebPage
Post by: Bruce on October 12, 2012, 04:41:19 AM
Hi Mike,

it's not really me, it's a Clarion template command (called QUOTE I think) which does that. Basically
it turns < into <<, { into {{, ' into '' and so on.

the <13,10> I think is just a convenience I add.

Early versions of clarion choked on < because < has a special meaning in a clarion string (so turning them into << is safer).
However later versions of clarion got smart and < will work ok, as long as it's not followed by a number.

If you wanted to replace < with << or whatever then I'd personally just use the StringTheory REPLACE command.

cheers
Bruce



Title: Re: Dynamic XHTML insertion in NetWebPage
Post by: springguy on October 12, 2012, 05:42:39 AM
Thanks Bruce!