Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
I have a formatted string that contains a description of an item (I'm using an extended RFT Editor then converting to HTML). I want to then insert that description into another field that contains HTML. I imagined using a placeholder of some sort in the HTML, but I'd be happy with another solution.
 
For example in pseudo html:
<PAGE HTML>
<DIV>
{DESCRIPTION}
</DIV>
<MORE PAGE HTML>
 
The RTF formatted string will be converted to HTML, but the location of the insertion may change if I alter the HTML so using indexes etc is probably out.
 
The result will be a HTML template common to all records with placeholders, which is then used to build the display with the specific description embedded in the proper place for each record whe I upload to my website.
 
Any ideas on how to do this? I considered doing a straight find replace but wanted to know if there's a better way?
Posted 25-Apr-14 0:27am
Comments
gggustafson at 25-Apr-14 13:05pm
   
Have you considered using a class (and possibly an id) in your HTML for the placeholders? That way you do not rely on indices. I wrote an article Revised Green Links that does that.
Member 10773666 at 26-Apr-14 10:17am
   
Thanks for the fast response GG. I had a look at your green links article, but thats not what I want to do. Basically I am looking for a way to template a webpage and insert an items description (in HTML) in to the page. After reading your green links article I looked also at your master pages one with javascript and that one might do the trick. I'll have a p[lay with it and see if it will work. I don't have control of the page when it is uploaded, so they might not allow javascript to make cross domain calls, since I can't add the header and footer text files to the site. It gives me a good idea of where to start anyway :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 475
1 Maciej Los 349
2 Richard MacCutchan 220
3 BillWoodruff 219
4 Mathew Soji 160
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411028.1 | Last Updated 25 Apr 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100