Events Made Easy Forums Bug fixed or feature request implemented Conditional "#_LOCATIONPAGEURL" links in "Default location balloon format"

Viewing 40 posts - 1 through 40 (of 40 total)
  • Author
    Posts
  • #42411
    Anonymous
    Inactive

    If the following code is specified as the “Default location balloon format” to provide URL links from full location map balloons to individual event location pages, balloon links on those pages link to the pages being viewed. Would it be difficult to provide a conditional flag so those links don’t show on individual event location map balloons?

    <strong>#_NAME</strong><br/>#_ADDRESS<br/> #_TOWN<br/><a href=#_LOCATIONPAGEURL>Location Details</a><br/>#_DIRECTIONS

    #46210
    Franky
    Keymaster

    The problem is the rest of the string: I could test for it and replace #_LOCATIONPAGEURL by an empty string, but it would still leave you with the “Location Details” part …

    Maybe I need to add a new possibility: #_LOCATIONPAGEURL{“Location details”} that would generate the whole link part …

    #46211
    Anonymous
    Inactive

    Is it possible to HIDE if they are empty?

    Example:

    <h4 class=”widgettitle”>Event Website:</h4>

    #_ATT{eventsite}

    If there is no {eventsite} I’d like to hide the entire <H4 class> to save

    vertical real estate.

    Possible?

    #46212
    Franky
    Keymaster

    Kinda impossible: there’s no relation at all between the attribute and the surrounding html (and each person will do it differently …). I would suggest to use a default value then, e.g.

    #_ATT{eventsite}{'No site given'}

    It’s not exactly what you want but better than nothing …

    #46213
    Franky
    Keymaster

    And maybe something to try (haven’t done so myself yet): try entering your html as one value in the attribute description. I’ll make a multiline field of it, if it works 🙂

    #46214
    Anonymous
    Inactive

    I’ll try but that would require the admin to enter the HTML into the attribute…which will be a nightmare.

    Please consider setting up conditionals…

    Like..

    If #_ATT{eventsite} is empty, show X.

    If it isn’t, show Y.

    Simple If Elses would be awesome and powerful!

    #46215
    Franky
    Keymaster

    Seems simple to you, a nightmare to code up …

    #46216
    Anonymous
    Inactive

    What about allowing separate location balloon format specifications for the two map applications? That seems easier and more flexible in use than making part of a single default format conditional.

    #46217
    Anonymous
    Inactive

    Why are conditionals hard to code up?

    #46218
    Franky
    Keymaster

    Because I don’t see anybody else offer me the code 🙂

    But I found a nice workaround for conditionals, still needs to be tested more but this is the idea: in the formatting you can use other shortcodes, so I use the power of enclosing shortcodes wordpress provides to do the following:

    [events_if tag='_ATT{eventsite}'] show my html stuff with #_ATT{eventsite} [/events_if]

    I still need to refine it, and I’ll add the possibility to test for a value as well:

    [events_if tag='_ATT{color}' value='red'] show my html stuff with #_ATT{color} [/events_if]

    BUT: it will only work for placeholders you actually USE in that same format string. For the moment I can get it to work for normal placeholders, next thing up: the attribute placeholders and the time placeholders. And then also for the location placeholders of course.

    So you see: it takes a lot of work

    #46219
    Franky
    Keymaster

    ok, major progress: it seems to be working fine 🙂

    #46220
    Franky
    Keymaster

    Example for default single event format could be (don’t mind the html, output will be ugly):

    <p>#j, #M #Y - #H:#i</p><p>#_NOTES</p>#_LOCATIONPAGEURL
    [events_if tag='_ATT{color}' value='red'] color: #_ATT{color} [/events_if]
    [events_if tag='_ATT{price}'] price: #_ATT{price} [/events_if]
    [events_if tag='_TOWN'] the town is: #_TOWN [/events_if]

    #46221
    Franky
    Keymaster

    Ok, even better, you can now use all placeholders in the if-part as well, just by prepending them with “ESC”, eg:

    <p>#j, #M #Y - #H:#i</p><p>#_NOTES</p>#_LOCATIONPAGEURL
    [events_if tag='#ESC_ATT{color}' value='red'] color: #_ATT{color} [/events_if]
    [events_if tag='#ESC_ATT{price}'] price: #_ATT{price} [/events_if]
    [events_if tag='#ESC_TOWN'] the town is: #_TOWN [/events_if]

    #46222
    Franky
    Keymaster

    For conditional tags, I added 2 extra shortcodes: one to check if you’re viewing a single event details page and idem for a single location:

    #_IS_SINGLE_EVENT and #_IS_SINGLE_LOC

    [events_if tag='#ESC_IS_SINGLE_EVENT' value='1'] I'm on the single event [/events_if]

    @admintiger: this should help you along now 🙂

    #46223
    Anonymous
    Inactive

    That looks great! I will test it after breakfast.

    #46224
    Franky
    Keymaster

    A small thing to watch out for: wordpress expects a whitespace before “[” for shortcodes, so this won’t work:

    [events_if tag='#ESC_IS_SINGLE_EVENT' value='1']I'm on the single event[/events_if]

    but this will:

    [events_if tag='#ESC_IS_SINGLE_EVENT' value='1'] I'm on the single event [/events_if]

    #46225
    Anonymous
    Inactive

    So, far I haven’t been able to make this work with the current trunk version:

    [events_if tag='#ESC_IS_SINGLE_LOC' value='1'] I'm on a single location [/events_if]

    However, I don’t understand where to set the value to ‘1’ and that probably is the problem, because the following displays “I’m on a single location” whether or not I am on a single location page:

    [events_if tag='#ESC_IS_SINGLE_LOC' value='0'] I'm on a single location [/events_if]

    What I actually need is to display an anchor link when not on a single location page, because the link is to that page.

    #46226
    Franky
    Keymaster

    try again please, the “_” was ignored as part of a placeholder … (and I changed the check a bit as well)

    #46227
    Anonymous
    Inactive

    With either of the following in the “Default location balloon format” the “[locations_map]” shortcode displays a map rectangle that is empty except for the word “map” in the upper-left corner and the string “I’m on a single location” displays in single location map balloons:

    [events_if tag='#ESC_IS_SINGLE_LOC' value='1'] I'm on a single location [/events_if]
    [events_if tag='#ESC_IS_SINGLE_LOC' value='0'] I'm on a single location [/events_if]

    #46228
    Franky
    Keymaster

    Ok, I was checking with “empty” and the 0-value falls under that cat (you could use notvalue, I implemented these: value, notvalue, lt, gt). I changed the logic, so it should work now.

    Try the latest trunk again (the “map” was because of an extra string being printed for testing, and was still in trunk)

    #46229
    Anonymous
    Inactive

    #ESC_IS_SINGLE_LOC works as expected now. Thanks for adding this capability.

    I haven’t tested #ESC_IS_SINGLE_EVENT yet.

    #46230
    Anonymous
    Inactive

    Awesome! Is this going to be part of the next release? (when?) as I have a bunch of events stored and do not want to replace a stable release with a trunk.

    Thanks for jumping on this! This will make a world of difference.

    #46231
    Franky
    Keymaster

    It will be in the next version. I’m holding any new features until after the next release (hopefully this week).

    EDIT: I also added #_IS_LOGGED_IN as a third extra, so you can decide what to show whether people are logged in or not.

    #46232
    Anonymous
    Inactive

    Fantastic. Looking forward to upgrading and using it.

    #46233
    Franky
    Keymaster

    And another placeholder added: #_IS_ADMIN_PAGE , so you can decide to show certain info only on the admin page

    #46234
    Franky
    Keymaster

    Btw: do keep me posted on the testing! I want to make sure I squashed all the current known bugs before releasing.

    #46235
    Anonymous
    Inactive

    I may be doing something wrong, but this doesn’t seem to work:

    [events_if tag='#_IS_LOGGED_IN value='1'] You are logged in [/events_if]

    #46236
    Anonymous
    Inactive

    I just noticed a missing ‘ after #_IS_LOGGED_IN. Will retest.

    #46237
    Anonymous
    Inactive

    Now it works. First mistake I ever made!!!

    These have both been tested and found to work correctly:

    [events_if tag='#_IS_LOGGED_IN' value='0'] You are logged in [/events_if]
    [events_if tag='#_IS_LOGGED_IN' value='1'] You are logged in [/events_if]

    #46238
    Anonymous
    Inactive

    These have both been tested and found to work correctly:

    [events_if tag='#ESC_IS_SINGLE_EVENT' value='0'] This is a single event [/events_if]
    [events_if tag='#ESC_IS_SINGLE_EVENT' value='1'] This is a single event [/events_if]

    #46239
    Franky
    Keymaster

    Tip: you can use any normal placeholder in the [events_if] shortcode, but if it contains any quotes, carriage returns, etc … it will fail. That’s why I invented the #ESC method here (it escapes the whole lot)

    #46240
    Anonymous
    Inactive

    I am not sure where you intend #_IS_ADMIN_PAGE to be used.

    #46241
    Franky
    Keymaster

    some people want some data to be shown just on the admin itf, so there it is 🙂

    #46242
    Anonymous
    Inactive

    I’m having a problem with [events_if tag="#ESC_ATT{xxxx}"]#_ATT{xxxx}[/events_if]. I haven’t tested it with non-attribute placeholders, but the #ESC portion seems to break it. It works just fine if tag=”#_ATT{xxxx}”. Just wondering what your rationale is for escaping the placeholder.

    #46243
    Franky
    Keymaster

    See 3 posts up and the fact that the placeholder gets replaced before the [events_if] shortcode is interpreted …

    Give me an example of a placeholder thing that breaks, so I can fix it.

    #46244
    Anonymous
    Inactive

    [events_if tag="#ESC_ATT{Image URL}"] <img src=”#_ATT{Image URL}” /> [/events_if]

    Are you saying to only use #ESC if the attribute has quotes or carriage returns?

    #46245
    Franky
    Keymaster

    Ok, should be fixed in trunk

    #46246
    Anonymous
    Inactive

    What is the correct usage? Is it proper to always use #ESC when using the [events_if] shortcode? Or only when the attribute you’re testing for has a quote or other meaningful character?

    #46247
    Franky
    Keymaster

    Best to always use it 🙂

    #46248
    Anonymous
    Inactive

    Works! Thanks…

Viewing 40 posts - 1 through 40 (of 40 total)
  • The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.
Scroll to Top