E-Tags, S-Tags and Replacing Text

Options
I have an s tag that may contain more than one value in the string. For example:

S1= cat; dog


I want to append those 2+ values to their own urls. For example:

www.test.com/cat

www.test.com/dog


Can someone supply the E-tag and S-tag code snippet that would replace the semicolon with a break and the link repeated?


This isn't correct, but something like:

www.test.com/[[E130: [[S1:custom_string]] text ";""<br>"www.test.com" replaceall]]
Tagged:

Comments

  • Why not do the string delimiter splitting and parsing back via Javascript (i.e. use jQuery prop to populate the href attributes if you are building back those links individually)


    Declare your LO session variables either through the s_varname parameter or through the U0, and pass the value into a JS variable so that it could further be split into JS array. 

    Something like this fashion

    [[U0:animals=cat,dog,elephant]]
    var myString = "[[S1:animals]]";

    var myArray = myString.split(',');



    Then you loop the array and rebuilt the URL through jQuery.prop let say.


    Reason I am saying that is I am not aware of / not sure if there's a way to loop through the array with S-tag (would be good to know too in case if someone elses done that)


    regards,

    Daniel

     

    Nick Minnich:

    I have an s tag that may contain more than one value in the string. For example:

    S1= cat; dog


    I want to append those 2+ values to their own urls. For example:

    www.test.com/cat

    www.test.com/dog


    Can someone supply the E-tag and S-tag code snippet that would replace the semicolon with a break and the link repeated?


    This isn't correct, but something like:

    www.test.com/[[E130: [[S1:custom_string]] text ";""<br>"www.test.com" replaceall]]

     

  • Ah here's the kicker...this solution would need to be email-friendly. My bad on leaving that key piece of info out. 


    However, your javascript solution is great for when I do related pages in the CMS.  Definitely will keep that in mind--thanks Daniel.. 

     
  • ah i see.. email-friendly hmm.. backtracking a bit --  I might probably still miss the bigger picture as of do we actually need to use session variable or to do away with within email. Thinking out wildly/guessing here - If you are to conditionalize message (including building those URL differently) for a specific group of audience, would that be achieveable through the S-tag conditional checking on whether the intended recipient is enrolled into specific group like for example  through the use of that S45 tag i.e. 


    [[?xx[[S45:REPLACEWITHGROUPID]]xx::xxTRUExx::
    <a href="http://www.example.com/cat">click here</a>


    ::]]

    and so  on..


    Just a thought (sorry for branching out the original discussion / question :))


    regards,

    Daniel




     

    Nick Minnich:

    Ah here's the kicker...this solution would need to be email-friendly. My bad on leaving that key piece of info out. 


    However, your javascript solution is great for when I do related pages in the CMS.  Definitely will keep that in mind--thanks Daniel.. 

     

     

  • Brilliant! That totally would get the job done for my purposes.I would just do a group-building query that looks for the semi-colon. Then I can serve them different content than the people with only one thing populated. 

Categories