Events Made Easy › Forums › Bug fixed or feature request implemented › Conditional "#_LOCATIONPAGEURL" links in "Default location balloon format"
Tagged: only load js on events page
- This topic has 39 replies, 4 voices, and was last updated 13 years, 10 months ago by Anonymous.
-
AuthorPosts
-
Thu 13 Jan 2011 at 23:42 #42411AnonymousInactive
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
Fri 14 Jan 2011 at 10:04 #46210FrankyKeymasterThe 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 …
Fri 14 Jan 2011 at 15:28 #46211AnonymousInactiveIs it possible to HIDE if they are empty?
Example:
<h4 class=”widgettitle”>Event Website:</h4>
If there is no {eventsite} I’d like to hide the entire <H4 class> to save
vertical real estate.
Possible?
Fri 14 Jan 2011 at 15:30 #46212FrankyKeymasterKinda 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 …
Fri 14 Jan 2011 at 15:32 #46213FrankyKeymasterAnd 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 🙂
Fri 14 Jan 2011 at 15:56 #46214AnonymousInactiveI’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!
Fri 14 Jan 2011 at 19:54 #46215FrankyKeymasterSeems simple to you, a nightmare to code up …
Fri 14 Jan 2011 at 21:26 #46216AnonymousInactiveWhat 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.
Sat 15 Jan 2011 at 03:56 #46217AnonymousInactiveWhy are conditionals hard to code up?
Sat 15 Jan 2011 at 09:15 #46218FrankyKeymasterBecause 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
Sat 15 Jan 2011 at 11:28 #46219FrankyKeymasterok, major progress: it seems to be working fine 🙂
Sat 15 Jan 2011 at 11:35 #46220FrankyKeymasterExample 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]Sat 15 Jan 2011 at 13:27 #46221FrankyKeymasterOk, 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]Sun 16 Jan 2011 at 15:50 #46222FrankyKeymasterFor 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 🙂
Sun 16 Jan 2011 at 16:01 #46223AnonymousInactiveThat looks great! I will test it after breakfast.
Sun 16 Jan 2011 at 16:38 #46224FrankyKeymasterA 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]
Sun 16 Jan 2011 at 17:26 #46225AnonymousInactiveSo, 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.
Sun 16 Jan 2011 at 20:56 #46226FrankyKeymastertry again please, the “_” was ignored as part of a placeholder … (and I changed the check a bit as well)
Sun 16 Jan 2011 at 21:57 #46227AnonymousInactiveWith 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]Sun 16 Jan 2011 at 22:34 #46228FrankyKeymasterOk, 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)
Sun 16 Jan 2011 at 23:45 #46229AnonymousInactive#ESC_IS_SINGLE_LOC works as expected now. Thanks for adding this capability.
I haven’t tested #ESC_IS_SINGLE_EVENT yet.
Mon 17 Jan 2011 at 04:45 #46230AnonymousInactiveAwesome! 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.
Mon 17 Jan 2011 at 08:35 #46231FrankyKeymasterIt 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.
Mon 17 Jan 2011 at 18:29 #46232AnonymousInactiveFantastic. Looking forward to upgrading and using it.
Mon 17 Jan 2011 at 18:39 #46233FrankyKeymasterAnd another placeholder added: #_IS_ADMIN_PAGE , so you can decide to show certain info only on the admin page
Tue 18 Jan 2011 at 09:56 #46234FrankyKeymasterBtw: do keep me posted on the testing! I want to make sure I squashed all the current known bugs before releasing.
Tue 18 Jan 2011 at 14:36 #46235AnonymousInactiveI 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]
Tue 18 Jan 2011 at 14:38 #46236AnonymousInactiveI just noticed a missing ‘ after #_IS_LOGGED_IN. Will retest.
Tue 18 Jan 2011 at 14:40 #46237AnonymousInactiveNow 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]Tue 18 Jan 2011 at 14:52 #46238AnonymousInactiveThese 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]Tue 18 Jan 2011 at 14:59 #46239FrankyKeymasterTip: 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)
Tue 18 Jan 2011 at 15:03 #46240AnonymousInactiveI am not sure where you intend #_IS_ADMIN_PAGE to be used.
Tue 18 Jan 2011 at 15:07 #46241FrankyKeymastersome people want some data to be shown just on the admin itf, so there it is 🙂
Wed 19 Jan 2011 at 17:10 #46242AnonymousInactiveI’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.
Wed 19 Jan 2011 at 19:01 #46243FrankyKeymasterSee 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.
Wed 19 Jan 2011 at 19:44 #46244AnonymousInactive[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?
Wed 19 Jan 2011 at 23:18 #46245FrankyKeymasterOk, should be fixed in trunk
Thu 20 Jan 2011 at 14:51 #46246AnonymousInactiveWhat 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?
Thu 20 Jan 2011 at 14:53 #46247FrankyKeymasterBest to always use it 🙂
Thu 20 Jan 2011 at 16:10 #46248AnonymousInactiveWorks! Thanks…
-
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.