Written a plugin that outputs a time field, strange thing is though that it does something strange for 7:00 to 8:59 times.
<li>{event_start_time} to {event_end_time}</li>
<li>{event_start_time}</li>
<li>{event_end_time}</li>
The above template code outputs as follows:
7:00 pm to "" pm
7:00 pm
8:00 pm
As you can see the first line kills the {event_end_time}, but only when that time ouputs anything between 7:00 and 8:59. Also to experiment I typed in “7:00 pm” instead of using the tag and the same result! So something in the template output processor is killing 7:00 to 8:59.
Anyone have ANY ideas why this is happening?
I may shift this to plugins until we can confirm it’s a bug in core- but:
Also to experiment I typed in “7:00 pm” instead of using the tag and the same result!
Do you mean if you just put 7:00 pm in a template, it gets wiped out? In other words- is it possible to reproduce w/out the plugin and if so, can you walk me through it?
Robin, Yes, bypassing the plugin I can reproduce the issue. If I have the following in a template:The 7:00 in the first <li> gets deleted.<ul> <li>6:00 pm to 7:00 pm</li> <li>6:00 pm</li> <li>7:00 pm</li> </ul>
Just tried that here in a template with nothing else in it and as I suspected it would, it all displayed fine. Are you just placing that into a template with nothing else in there? This isn’t in between a weblog tag or anything like that? That said I wouldn’t expect that to do anything like that though.
Also you’re not using caching on the template are you and perhaps you are seeing the output of the template when it had the plugin in there are you?
Best wishes,
Mark
Mark,
Actually it’s between my plugin’s tag pair. However nowhere in my plugin am I doing anything with the specific strings between 7:00 and 8:59.
$TMPL->swap_var_single is used to swap out the vars.
Here’s a sample snippet of the template code:
{event_start_time} and {event_end_time} are custom fields and not specific to my plugin. Also if I put 7:00pm instead of 7:00 pm all is good.
This is so weird.
Ah sorry I thought that when you said previously that you had bypassed the plugin you meant that you had taken the plugin completely out of the equation and the template.
It does seem a little weird although without us seeing your plugin code in full could be difficult to say really. You say you are using the swap_var_single code to replace variables, have you tried just sending back the tagdata via the plugin just so that you can make sure that whatever you place in between the plugin tags gets sent back correctly. That would be the first thing to check I reckon and then move on to swapping variables and stuff like that after if that all works.
So if you put this in your template :
{exp:eevents:display weblog="events" dynamic="off" parse="inward"}
<ul>
<li>6:00 pm to 7:00 pm</li>
<li>6:00 pm</li>
<li>7:00 pm</li>
</ul>
{/exp:eevents:display}
with your plugin coded in the relevant way :
$this->return_data = $TMPL->tagdata;
to just spit out whatever it sees in between the tag pair then you should be getting this on the output :
<ul>
<li>6:00 pm to 7:00 pm</li>
<li>6:00 pm</li>
<li>7:00 pm</li>
</ul>
That will rule out if it’s anything to do with the characters perhaps and a plugin parsing that tagdata. If it doesn’t come back as expected then it may well be a bug. If it does come back as expected then it will be something else but it will be difficult for us to say without first seeing your full plugin code.
Hope that helps a bit.
Best wishes,
Mark
Ah sorry I thought that when you said previously that you had bypassed the plugin you meant that you had taken the plugin completely out of the equation and the template.
Fred, can I ask you to do exactly that? Try with as few tags as possible, and no third-party addons, please.
Don’t know if this helps at all but just created a really really simple plugin to show what I meant previously.
Basically it just returns whatever you place within the plugin tags. I’ve just tested it out on a brand new install of ExpressionEngine 1.6.7 and whatever you place within the tags gets spat back out again exactly as it is within the tags so if it doesn’t do this on your system then I suspect there might be something else going on somewhere.
Hopefully it might help in troubleshooting this one for you.
Usage
{exp:dummy_output}
<ul>
<li>6:00 pm to 7:00 pm</li>
<li>6:00 pm</li>
<li>7:00 pm</li>
</ul>
{/exp:dummy_output}
Best wishes,
Mark
Yep- I can’t spot why it would happen in the core code. If you can’t narrow it down- is it possible to attach the plugin? Or you can zip it up an pm me a copy.
For now- I’m going to shift to the plugin forum. But I’ll stay subscribe. I suspect I may need to test w/the plugin code to fully ‘get’ what’s happening.
Ingmar + Robin,
Thanks for the help, tried various tests including just using a weblog:entries tag without failure. So something in my plugin must be causing the issue. However I’m not touching anything.
I have a FieldFrame type that stores a time in 24 hour format and outputs it. My plugin then passes the tagdata to the weblog_entries_tagdata to replace the variables/custom fields in the tagdata. At this point, even if I force my FieldFrame type to only return the string “7:00 pm”, the problem shows up. This is even BEFORE my plugin has touched anything in the tagdata. So this is really odd.
Here’s a snippet for the plugin’s function where the problem is occurring.
// -------------------------------
// Parse tags
// - return the content with replaced tags
//
// @param tag_content the template to replace tags in / content of tag pair
// @param occurrence array containing the occurrence data
//
// @returns string
// -------------------------------
function _parse_tags($tag_content, $occurrence) {
global $EXT, $TMPL;
//echo "<pre>" . print_r($occurrence, true) . "</pre>
<p>\n”;
//exit(‘dead’);</p>
<pre><code> // -------------------------------------------
// 'weblog_entries_tagdata' hook.
// - Take the entry data and tag data, do what you wish
//
if ($EXT->active_hook('weblog_entries_tagdata') === TRUE)
{
$tag_content = $EXT->call_extension('weblog_entries_tagdata', $tag_content, $occurrence, $this);
if ($EXT->end_script === TRUE) return $tag_content;
}
//
// -------------------------------------------</code></pre>
Any help or insight would be greatly appreciated.
Do these lines :
if ($EXT->active_hook('weblog_entries_tagdata') === TRUE)
…
if ($EXT->end_script === TRUE) return $tag_content;
need to be :
if ($EXT->active_hook('weblog_entries_tagdata') == TRUE)
…
if ($EXT->end_script == TRUE) return $tag_content;
I always get mixed up with what the exact difference is between having two equals signs and three.
Robin, no hints on output. The only hint is that output of $tag_content immediately after the active_hook snippet shows the failing content in the mentioned scenario. So 7:00 is replaced with empty quotes. The only extension linked to this is Brandon Kelly’s FieldFrame as the custom field is a FieldFrame fieldtype. However, as mentioned before even if I bypass this and just type 7:00 in the template the issue persists.
Just found the trigger!! In my template I had:
{if event_start_time}<li>{event_start_time} to {event_end_time} 7:00 pm</li>{/if}
If I take out the conditional everything works as expected. Good to know, but still not sure how to fix the issue as conditionals will need to be used.
Suggestions from the geniuses?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.