RSS

LuxCal Forum

The place for questions, suggestions and news about the LuxCal Event Calendar

User:   Password:   Remember Me?   
LuxCal Forum / General / Problems / Show category in page index
Posted:  30 Dec 2015 01:55
Hello ,
I added 3 categories:
Description 1
Description 2
Description 3
Each cathegories has a distinct color

I add this code on index.php , but i cant see the result
When i move in the cathegorie  http://localhost/luxcal400/index.php?lc&cP=91
Page turns white


    echo "<div class='fieldBox'>n";
    $rSet = dbQuery("SELECT * FROM [db]categories WHERE status >= 0 ORDER BY sequence");
    if ($rSet !== false) {
        echo "<table class='list'>
            <tr>
            ".(!$edit ? '<th></th><th></th>': '')."</tr>n";
        if (mysql_num_rows($rSet) > 0) {
            while ($row=mysql_fetch_assoc($rSet)) {
                $style = ($row['color'] ? "color:{$row['color']};" : '').($row['background'] ? "background-color:{$row['background']};" : '');
                $style = $style ? " style='{$style}'" : '';
                echo "<tr>
                          <td{$style}>".stripslashes($row['name'])."</td>";
                echo "</tr>n";
                                                  }
                                       }
        echo "</table>n";
                         }



Here in the picture that I try to do :
http://img15.hostingpics.net/pics/155352Cathegorie.png

If you have an idea
Thank you
Posted:  30 Dec 2015 21:44   Last Edited By: Roel B.
Hi Eamon,

I will try to help, but first I have a few comments/questions:
I think you are still using LuxCal 3.x, which means your calendar is still using the PHP mysql extension. This extension is deprecated as of PHP 5.5. and is removed as of PHP 7.0. You should start planning a switch-over to PDO-MySQL.
The test "mysql_num_rows($rSet) > 0" is redundant; it's already included in the "while" test.
What is the purpose of the two empty table headers (<th></th><th></th>)?First of all they're empty and secondly, later you have only one data cell (td).

Why do you include this code in the index.php file? If you want to display the category colors at the end of the week and day view, you should add the code to the dw_functions.php file and if you want cat colors at the end of every page, it should maybe be added to the footer.php file.
Roel
Posted:  31 Dec 2015 06:30
Thanks Roel
Resolved