Need help with Joomla? We are available for hire to help with Joomla customization, upgrades, maintenance, and custom development.
Explore our services

Color-Code Upcoming-Event Module [Solved]

  • Dycon
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 11 months ago - 13 years 11 months ago #20000 by Dycon
Hi there, I have been playing with the php to make it a bit more "custom" and to achieve my goal...

everything seems to be ok, until I hit the wall...

what I want is to add a background color to the Title of the event or to the category of the X event...
now the color has to be the one that has been assigned to the category in the back-end so when the module display the information each event can have the background color of each category in question.
Event X
Category A

Event F
Category B

I did a search and I find this
joomdonation.com/62-general-discussion/1...eb_events.html#16723

but still, I can get the value of color_code
all i get in result is "Array", of curse I only used the info on the link as a reference in order to get what I want but I can't

From mod_eb_events
file mod_eb_events.php
Line more or less 38:
Code:
$sql = 'SELECT a.id, a.name, FROM #__eb_categories AS a INNER JOIN...
I added the color_code as follow
Code:
$sql = 'SELECT a.id, a.name, a.color_code FROM #__eb_categories AS a INNER JOIN

then after "$itemCategories[] = ..." I added the following
"$colorBG = $row->color_code;"

then on file tmpl/default.php
I added just an echo as follow
Code:
<?php echo $colorBg; ?>

but before that and before I came to your website I did a hundred more combinations and nothing worked...
I wanted to do it on my own, but after one day looking for a solution... I guess, I'm just tired...
I'm not a programer or anything, I'm just want to learn...

So how can I get the category color assigned on the back end?
once I get the color_code value, I guess I can apply the code to anything I want...
something like
<td <?php echo 'style="background-color:#'.$color.'";' ; ?>>
or
<span <?php echo 'style="color:#'.$color.'";' ; ?>>
I want to use this value for
mod_eb_events

Thank you! for taking the time..
Last edit: 13 years 11 months ago by Dycon. Reason: Solved by: Administrator

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #20032 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Color-Code Upcoming-Event Module
Hi

There are small mistake in your code (maybe you were tired). Please follow the instructions below :

1. Get this file, unzip it, upload t0 modules/mod_eb_events folder .

2. In the file modules/mod_eb_events/tmpl/default.php, to get color code for each event, simply use :
Code:
$colorBg = $row->color_code ;

3. With the given color code, I believe you can do what you want .

Hope this help .

Tuan
The following user(s) said Thank You: Dycon

Please Log in or Create an account to join the conversation.

  • Dycon
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 11 months ago #20047 by Dycon
Replied by Dycon on topic Re: Color-Code Upcoming-Event Module
I can hug you right now! lol :laugh:

It's working! just like I wanted!

I can't thank you enough.

Some how, I knew I had to read the $row, I just didn't know how to do it... I was going mad, reading over and over the code..

I think that by using the same technique, I can modified the mini-calendar... maybe not... who knows... I'll give it go and see what happen...

Thank you!!!!!!

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #20048 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Color-Code Upcoming-Event Module
Great it works for you. Hope you love the extension :).

If you have few minutes, could you please help me by giving Events Booking a 5 stars rating and a nice review at extensions.joomla.org/extensions/calenda...s-registration/13701 to support my development !

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Dycon
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 11 months ago #20196 by Dycon
Hi Tuan, I just did, sorry it toke me some time...

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #20201 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Color-Code Upcoming-Event Module [Solved]
Great. Thanks Dycon so much for your help !

Tuan

Please Log in or Create an account to join the conversation.

  • Dycon
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 11 months ago #20204 by Dycon
Hi Tuan, I was going to open a new topic but I'm not sure if it will be appropriate since it'll be related to color_code.

This time the file in question is:

com_eventbooking / views / category / tmpl / default.php

Line 87 or 88 more or less:
Tag: <h3>
which is the Event title

I already manage to display "Deposit Amount" for each event, also, at each event has to display a generic message, with some data from the event, I got that done no problem.

But for some reason that color_code keeps playing hard to get...


I know that the helper.php already has the color_code, and it's been used at
calendar / tmpl / default.php

but if I try to use it at the
category / tmpl / default.php

it just doesn't work...

if you have some time to help me with that please.

I'd love to have the "color_code" at:
category / tmpl / default.php

Thank you!

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #20207 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Color-Code Upcoming-Event Module [Solved]
hehe. Getting color_code in that file is pretty simple. You can use the code below in that file :
Code:
$db = JFactory::getDBO() ; $sql = "SELECT color_code FROM #__eb_categories WHERE id=".$this->category->id ; $db->setQuery($sql); $colorCode = $db->loadResult() ;

Hope this help !

Tuan
The following user(s) said Thank You: Dycon

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc