Welcome Guest, Not a member yet? Register   Sign In
Help modifying Calendar - add classes to TD
#1

[eluser]rt30000[/eluser]
Hello. I need a bit of help modifying the CI Calendar class. Basically, I would like to add classes to the opening td tag of calendar cells {cal_cell_start} (such as class="nocontent", class="hascontent", etc). So, rather than the class changing the content after the td, it would include the opening td tag as well so I could adjust the class.

The custom templates allows you to add code AFTER the opening td, but not the opening td tag itself. I seem to be stumbling at a solution here, any help is GREATLY appreciated. TIA
#2

[eluser]TheFuzzy0ne[/eluser]
Can't you just do something like this:

Code:
{cal_cell_no_content}<span class="no_content">{day}</span>{/cal_cell_no_content}

And then style it with CSS?
#3

[eluser]sophistry[/eluser]
this is a hacky way of doing it, but try it... it might save you some hair pulling - not a long-term solution, but the CI calendar class is a bit of a pig so it's not a long-term solution either!

set your cal_cel_start to an empty string. then, you can put a TD tag with a variable class into the cal_cell_content and cal_cell_no_content like this:

Code:
'cal_cell_content'            => '<td class="hascontent"><a href="{content}">{day}</a>',
'cal_cell_no_content'        => '<td class="hasnocontent">{day}',

HTH.
#4

[eluser]rt30000[/eluser]
Thx fuzzy, but the problem going that route is that I want to target background colors, styling etc depending on type of cell it is. I did use css on inner divs, but then you have 100% div height issues etc and it didn't feel like the proper way when styling the td itself would be ideal.

Sophistry - perfect! I agree, it definitely feels like a hack but nevertheless it works perfectly. Such a simple solution, I'm so glad I posted and you saved me hours of trying to modify the class unnecessarily. The CI calendar class is nice to have - but I feel like you have to jump through a lot of odd hoops to customize it. Thanks a million, this thing is rockin!




Theme © iAndrew 2016 - Forum software by © MyBB