Log in | Register | Lost password

Bottom
Searching within HTML, eliminating parts, adding other parts to variable in template
  • Posted: 26.01.2006, 21:22
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I am attempting to convert my PostNuke news to a new format. The old news has an image and links within the teaser portion of the story, but the Pagesetter version now has separate fields for the image and links.

    Is there a way to have the template automatically locate the image in the Teaser field, for instance, remove it, and add it to another variable in the template to be displayed elsewhere on the page?

    So, here's the code from an example story:

    Code

    <P><A href="http://www.lovespirals.com/"><IMG class=pic height=75 alt=Lovespirals src="http://www.regenmag.com/images/news/Lovespirals_1.jpg" width=75 align=right border=0></A>War-N Harrison of Hungry Lucy launches the podcast, "The Sonic Spotlight,"as a way&nbsp;to promote and connect the indie artist community. The initial episode features Southern California?s Lovespirals discussing several topics including the role of technology in making music and the group?s decision to release their latest CD,<EM> Free and Easy</EM>, without label support. Please visit the podcast web site for more information and to download the episode. </P>

    <P>--- --- ---</P>

    <P><A href="http://www.sonicspotlight.com/">Sonic Spotlight Web site </A></P> <P><A href="http://www.lovespirals.com/">Lovespirals Web site </A></P>


    The first link tag and img tag will need to be removed, and the image needs to be put in another variable in the template for output (the link could also be put in the same variable). All images have "class=pic", so it might be easy for an expression to identify them. The paragraph with the three sets of three dashes needs to be removed completely. The links that follow need to be taken out of the story and each of them should be put into a variable in the template for output. The number of links can actually vary from a total of one to four.

    I looked at the Smarty documentation, but it doesn't get into this kind of complex replacement. Can anyone offer any kind of help with this? Thanks in advance!

    Take care,
    Nick

Template courtesy of Designs By Darren.