Results 1 to 8 of 8
  1. #1
    Newbie
    Join Date
    January 18th, 2005
    Posts
    3
    I have been trying out WebMerge for 1 week now but I couldn't find a way to solve a URL problem.

    My database contains a hyperlink data field named as "url". What I want to do is: for records which contain data in "url", print [click here] and <a href> the hyperlink contained in that field; and for those which do not have data in "url", just return a "" in the html.

    I tried to use IsIn or does not contain in the syntax and wrote something like this:

    [WM-If: url .ncn. http]
    [WM-Else]<a href="[WM-Field: url nolink]">
    Click here</a>[/WM-If]

    But I just couldn't get it right. Can somebody help me on that? Thanks in advance!

  2. #2
    ABW Ambassador AWaR's Avatar
    Join Date
    January 18th, 2005
    Location
    Scotland
    Posts
    625
    The following 'should' do what you're looking for :

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    [WM-If: url DoesNotContain http]
    & nbsp;
    [WM-Else]&lt;a href="[WM-Field: url nolink]"&gt;Click here&lt;/a&gt;[/WM-If]

    <HR></BLOCKQUOTE>

    you'll need to remove the space between the & and nbsp;

    _________________________

  3. #3
    Newbie
    Join Date
    January 18th, 2005
    Posts
    3
    Thanks for your kind help. But it still doesn't work out for me. Webmerge just print the syntax out on every output page and show a long list of error log saying "invalid IF Expression: url does not contain http".

    Is there any other way for Webmerge to identify empty field?

  4. #4
    ABW Ambassador Mike O's Avatar
    Join Date
    January 18th, 2005
    Location
    Los Angeles area
    Posts
    843
    I think it's a WM bug.

    I had a similar problem awhile ago with the other form for that, the ".ncn." ("no contains") WM-if command.

    I submitted a note about it to Richard, and then I found a workaround through using the .cn. ("contains") command, followed by the WM-Else command to give me the same effect.

    In other words, "IF it contains XXX, (do nothing) ELSE (do what I wanted if it doesn't contain XXX).

    -- Mike
    A joy shared is a joy doubled.
    A burden shared is a burden lightened.

  5. #5
    Newbie
    Join Date
    January 18th, 2005
    Posts
    3
    I still couldn't get the job done correctly by using "contains".

    I wrote something like:

    [WM-If: url contains http]&lt;a href="[WM-Field: url nolink]"&gt;Click here&lt;/a&gt;
    [WM-Else]& nbsp;[/WM-If]
    (with no space in between & and nbsp)

    Though WebMerge no longer shows syntax error, it omits to insert the hyperlink even if the IF statement is satisfied. Any method that can get around this?

  6. #6
    ABW Ambassador AWaR's Avatar
    Join Date
    January 18th, 2005
    Location
    Scotland
    Posts
    625
    Try this out...

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    [WM-If: Field: url contains http]
    &lt;a href="[WM-Field: url nolink]"&gt;Click here&lt;/a&gt;
    [WM-Else]
    & nbsp;
    [/WM-If]
    (with no space in between & and nbsp)
    <HR></BLOCKQUOTE>

    This should work.

    _________________________
    "Yesterday we obeyed kings and bent our necks before emperors. But today we kneel only to truth..." - Kahlil Gibran

  7. #7
    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 MikeO:
    I think it's a WM bug.

    I had a similar problem awhile ago with the other form for that, the ".ncn." ("no contains") WM-if command.

    I submitted a note about it to Richard, and then I found a workaround through using the .cn. ("contains") command, followed by the WM-Else command to give me the same effect.

    In other words, "IF it contains XXX, (do nothing) ELSE (do what I wanted if it doesn't contain XXX). <HR></BLOCKQUOTE>

    Please forgive me if you've sent it, but I couldn't find a set of documents in my In Box which evidence the problem. I can generally fix errors very quickly once I can reproduce a problem, so as noted on the Support page sending the settings file, templates, and a portion of your feed will help me hone in on such issues quickly.
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  8. #8
    Newbie
    Join Date
    January 18th, 2005
    Posts
    16
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> [WM-If: Field: url contains http]
    &lt;a href="[WM-Field: url nolink]"&gt;Click here&lt;/a&gt;
    [WM-Else]
    & nbsp;
    [/WM-If]
    (with no space in between & and nbsp) <HR></BLOCKQUOTE>


    I was curious about this myself because I'm also struggling a little with IF/ELSE statements. ((I'm trying to get different navigation images and functionality for prev/next links based on whether the current index page is the first, last, or any in-between. I want to display greyed-out/non-functional arrows only on the first & last index pages. Now I'm resorting to writing formulas for my feed but haven't yet gotten one that works for the last index page. If this CAN be done just with WM tags, I'd love to know.))

    Anyway, for what it's worth, I tried a quick-and-dirty test of the last posted code for the URL link problem and it worked perfectly. If it would be any help in trouble-shooting your problem, I can send you my VERY SIMPLE test files to evaluate (11 items including the generated htmls, 8K zipped).

    Vera

  9. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Insertion of fields containing html codes
    By Pierre (aka Terdef) in forum WebMerge (Fourthworld.com)
    Replies: 4
    Last Post: June 28th, 2005, 10:09 AM
  2. Quick Hyperlink Formatting Question
    By sweat in forum Midnight Cafe'
    Replies: 5
    Last Post: December 21st, 2004, 03:34 PM
  3. Retrieving a hyperlink from an access table
    By popdawg in forum Programming / Datafeeds / Tools
    Replies: 5
    Last Post: October 31st, 2002, 03:07 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
  •