Skip navigation
Currently Being Moderated

Dynamic Web App Tags?

Aug 3, 2012 10:50 AM

Tags: #tags #dynamic #web_app #alternate_tag

Hi all,

I've created a web app which displays a list of items linking to their own detail views, using:

 

<li><a href="/CustomContentRetrieve.aspx?ID={tag_itemid}"><img src="{tag_Image-Thumb_value}" width="220" alt="{tag_name_nolink}" /></a></li>

 

A few of the items need to link to external URLs, not detail view pages.

 

<a href="/CustomContentRetrieve.aspx?ID={tag_itemid}"> needs to get replaced with an external URL somehow...

 

Is there a way make to do this within the same web app? A checkbox perhaps?  The client needs to be able to toggle the external, non-Content retrieve item.

 

I'm stumped!

Thx,

Brian

 
Replies
  • Liam Dilley
    6,673 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 3, 2012 1:32 PM   in reply to AvaloDesign

    May I ask why you are using the nasty looking custom retrieve URL and not one of the web app URL tags?

    You have no conditions yet, so if you want a url to change you need a tick box to use as a class that changes per item and a hidden maybe HTML5 data attribute if your using that doctype for example and javascript to detect which link is needed to use and for that web app item replace the href of the link with the external one which comes from a text string custom field.

     
    |
    Mark as:
  • Liam Dilley
    6,673 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 3, 2012 2:04 PM   in reply to AvaloDesign

    Must have been the old knowldgebase not the new one. You will always run into issues if you do that.
    http://forums.adobe.com/community/business_catalyst - Overview page of these very forums, you looked on the right?

    http://helpx.adobe.com/business-catalyst/kb/tags---quick-reference.htm l

    Go to web apps, what do you see ?

     

    You have a checkbox option that says "link to external url" and then have custom field (not mandatory) as a text so you can copy and paste an external link in.

     

    On the li of the layout you add a class of something like isExternal{tag_external url tag name here}

    You then add the HTML5 attribute data which can be used to specify any data name you want so the li would form something like:

     

    <li class="isExternal{TAG OR CHECKBOX HERE} data-extlink="{TAG FOR TEXT FIELD FOR URL}">
    

     

    Then in say jquery you run a loop (.each() ) on the LI.

    If it has isExternal1 (true) and data-extlink is not empty ( .hasClass() & .attr() ) Then you can say something like..

     

    // Store the value:
    var extLinkVal = $(this).attr(data-extlink);
    

     

    $('a',this) OR  $(this).find("a") (both work)

    so..

    $('a',this).attr('href',  extLinkVal);

     

    And your sorted.

     
    |
    Mark as:
  • Liam Dilley
    6,673 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 6, 2012 6:05 PM   in reply to AvaloDesign

    How do you know when to triger it?

    Is it internal or external - That is your check box.

     

    If that tag = External

    Then do xxxx ( run your code )

    else that tag will be Internal

    Then Do xxxx or nothing.

     

    You will see a lot of people posting jQuery that blindly runs no matter what - very poor on perfomance and also will error because if the element does not exist on the page then it will produce a null and error in a lot of cases.
    See a lot of people running complex code even when the page is not on, so things look, try to run and dont when you should not run them at all ^^

     
    |
    Mark as:
  • Liam Dilley
    6,673 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 6, 2012 7:54 PM   in reply to AvaloDesign

    That was insite but to what you doing you will still need to do the if to say if this then run your script to do what you need.


    First step is to learn to do a function, you can do this inline as you do for now but you wrap your functionality in a function...

     

    function myThing() {

    // Do your stuff

    }

     

    Then you call it when you need it
    If( element exists or time to run this ) { myThing() }

     

    Then you can move on to objects and more

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points