Results 1 to 4 of 4
  1. #1
    Newbie
    Join Date
    January 18th, 2005
    Posts
    6
    I want to write some lines of code which will create the HTML for an image, if the field [pic2] contains the name of a jpg file [eg house.jpg], but which will do nothing visible if the image field of my database is empty. This is what I tried:
    <P>[WM-If: pic2 DoesNotContain jpg]

    [WM-Else]<img src="../../../j/[WM-Field pic2]"></P>

    This produced the error message "Error processing record 1: [No closing tag for [WM-IF] in detail template". I am new to WM and the idea for this code came from: AWaRâ„¢ Help and advice on how to do the coding would be much appreciated.

  2. #2
    Affiliate Manager
    Join Date
    January 18th, 2005
    Location
    Los Angeles, California
    Posts
    1,913
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Primrose:
    I want to write some lines of code which will create the HTML for an image, if the field [pic2] contains the name of a jpg file [eg house.jpg], but which will do nothing visible if the image field of my database is empty. This is what I tried:
    &lt;P&gt;[WM-If: pic2 DoesNotContain jpg]

    [WM-Else]&lt;img src="../../../j/[WM-Field pic2]"&gt;&lt;/P&gt;

    This produced the error message "Error processing record 1: [No closing tag for [WM-IF] in detail template". I am new to WM and the idea for this code came from: http://abw.infopop.cc/eve/ubb.x?a=tp...0745#693100745 Help and advice on how to do the coding would be much appreciated. <HR></BLOCKQUOTE>

    Check out the examples provided in the WebMerge Help page for the WM-If tag. You'll see that [WM-If] tags must end in [/WM-If] in order for WebMerge to know where that block ends.
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  3. #3
    ABW Ambassador AWaR's Avatar
    Join Date
    January 18th, 2005
    Location
    Scotland
    Posts
    625
    Ok, I'll step up to the plate for this one

    We'll do this the easy way without the need to use the [WM-Else] command.


    <pre class="ip-ubbcode-code-pre">[WM-If: Field: pic2 &lt;&gt; ""]
    &lt;P&gt;&lt;img src="../../../j/[WM-Field pic2]"&gt;&lt;/P&gt;
    [/WM-If]</pre>

    What this does is check to see if the field 'pic2' actually contains data, and if it does, it will write the data. If the 'pic2' field is empty, it will just ignore it and continue with the rest of the template.

    [edit: typo]

  4. #4
    Newbie
    Join Date
    January 18th, 2005
    Posts
    6
    Thank you both very much.

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. WebMerge - Inserting a Java Code Field
    By 1che in forum Midnight Cafe'
    Replies: 0
    Last Post: June 11th, 2012, 06:03 PM
  2. New Coupon Code - CARLSBAD FLOWER FIELD DEALS
    By AffiliRed Platform in forum AffiliRed
    Replies: 0
    Last Post: February 15th, 2012, 01:24 AM
  3. Can a record be excluded if one field is empty?
    By AlexS in forum WebMerge (Fourthworld.com)
    Replies: 2
    Last Post: May 24th, 2005, 12:19 AM
  4. Possible to define an image's alt tag from a field?
    By jsegal in forum WebMerge (Fourthworld.com)
    Replies: 1
    Last Post: May 3rd, 2004, 05:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •