Style Date in Group Heading

Status
Not open for further replies.
I need to be able to put a break between the day of the week and the month/day number in my group heading in my list (http://ciderweek.ohbusyweaver01.com/index.php/events). I would also like to style the day of the week differently than the month/day number.

Any ideas?

Fabrik: 3.0.6
Joomla 2.5.6

Can/should I use a calc element to pull the day of the week from the date and another calc element to pull the month and day?
 
How are you building that heading? I presume it's the 'front end template' in your List's group settings? If so, are you using a {tablename___elementname} placeholder to get that date string? Is it a date element? if so, what's the format string on it?

I'm just puzzled as to why there is no space there in the first place.

But yes, you may need a calc to do it, especially if you need different styling on the individual parts. We don't have an 'eval' option for the template, so it has to be done with placeholders. You'd only need one, though, which could build the formatted string you need.

So say your date element is {tablename___date}, something like ...

PHP:
$timestamp = strtotime('{tablename___date}');
return '<span style="whatever: foo">' . date('l', $timestamp) . '</span><span style="something: whatever">' . date('M', $timestamp) . '</span><span style="yada: yada">' . date('jS', $timestamp) . '</span>';

Obviously change the styling to suit your needs, and you might need to throw some &nbsp; in there, or set margins, to get the space between the spans.

I think I have the correct date() format strings to get your desired date string, though.

-- hugh
 
I am using the div template and grouping by an element called events___date. The list date format is set to: %A<br>%b %d. The <br> tag shows when the element is used but is stripped when grouping is used.

I will try the calc field. Thanks for your help.
 
Hmmm, not sure why we would strip tags, although that does ring a bell somewhere in my memory. If you find that tags get stripped from your calc in the group intro as well, let me know.

-- hugh
 
I ended up accomplishing this by splitting your calc code in two and creating two calc elements. I then placed the elements using the Group by/Front-end template box in the list settings.

Thanks.
 
Yes, it stripped the span tags. I also tried applying tags in the Group by/Front-end template box in the list settings. I can style the elements via the template_css.php file; however, it sees them as one. I want different styles for day of week and date. Is there a way to assign a class to them individually?
 
Hmmm, yup, for some reason we strip the tags.

try commenting out line 777 in ./components/com_fabrik/models/list.php (current github line number), so it looks like ...


PHP:
						// $grouptemplate = strip_tags($w->parseMessageForPlaceHolder($groupTemplate, JArrayHelper::fromObject($data[$i])));

I'll raise an issue in github asking Rob why we do that, as I can't offhand recall why, or think of any particular reason to do so.

-- hugh
 
I assume it should be not commenting out but deleting strip_tags
$grouptemplate = $w->parseMessageForPlaceHolder($groupTemplate, JArrayHelper::fromObject($data[$i]));
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top