pbrad
Posts: 58
|
| Posted: 03/15/2008, 2:58 PM |
|
Hi,
I have successfully adapted the Sothink DHTML menu to operate in MySQL PHP project with multiple levels of submenus which opens up all kinds of design options. The Header file calls a PHP page:
<script src="/js/DHTMLMenu.php" type="text/javascript"></script> for the actual configuration and population of the menu.
The problem that i have is that I want to filter the visible menu items based on the users session GroupID which is not available to me on this non ccs page. Is there any way for me to pass the GroupID variable to this page as some kind of Global Variable from a CCS page?
<?
$dbhost = "localhost"; // DB Host name
$dbusername = "xxx"; // DB User
$dbpass = "xxx"; // DB User password
$dbname = "xxx"; // DB Name
$query = "select * from menu_items_r where GroupID = $CCSGroupID" ; (<--- Need to access $CCSGroupID in this page)
$connection = mysql_connect($dbhost, $dbusername, $dbpass);
$resultCat = mysql_db_query($dbname, $query);
$numrowsCat = mysql_num_rows($resultCat);
for ($i = 0; $i < $numrowsCat; $i++)
{
$rowCat = mysql_fetch_array($resultCat);
$R1Name = $rowCat["Name"];
?>
Thanks for any help offered,
Pete
_________________
Pete
CCS 4
MySQL
PHP |
 |
 |
datadoit
|
| Posted: 03/15/2008, 2:27 PM |
|
GroupID is also a session var, so you should be able to do:
$query = "select * from menu_items_r where GroupID = '" .
$_SESSION['GroupID'] . "'" ;
|
|
|
 |
DonP
|
| Posted: 03/15/2008, 2:58 PM |
|
As a long time user of both DHTMLMenu and CCS, I always use pure CCS
code in it rather than starting over with a new connection and code.
That way you can use the same CCS functions that you're used it.
However, to do so, it is necessary to call the menu as an object so I
set a label to HTML and add a Before Show event like this:
ob_start();
include("./menu/popup/help_popup.js");
$contents = ob_get_contents();
ob_end_clean();
$PageMenu->SetValue("<script type=\"text/javascript\">" . $contents .
"</script>");
It seems to work only with a relative path rather than an absolute path.
Don (DonP)
pbrad wrote:
> Hi,
>
> I have successfully adapted the Sothink DHTML menu to operate in MySQL PHP
> project with multiple levels of submenus which opens up all kinds of design
> options. The Header file calls a PHP page:
>
> <script src="/js/DHTMLMenu.php" type="text/javascript"></script> for the actual
> configuration and population of the menu.
>
> The problem that i have is that I want to filter the visible menu items based
> on the users session GroupID which is not available to me on this non ccs page.
> Is there any way for me to pass the GroupID variable to this page as some kind
> of Global Variable from a CCS page?
>
> <?
> $dbhost = "localhost"; // DB Host name
> $dbusername = "xxx"; // DB User
> $dbpass = "xxx"; // DB User password
> $dbname = "xxx"; // DB Name
> $query = "select * from menu_items_r where GroupID = $CCSGroupID" ; (<---
> Need to access $CCSGroupID in this page)
> $connection = mysql_connect($dbhost, $dbusername, $dbpass);
> $resultCat = mysql_db_query($dbname, $query);
> $numrowsCat = mysql_num_rows($resultCat);
>
> for ($i = 0; $i < $numrowsCat; $i++)
> {
> $rowCat = mysql_fetch_array($resultCat);
> $R1Name = $rowCat["Name"];
> ?>
>
> Thanks for any help offered,
>
> Pete
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
pbrad
Posts: 58
|
| Posted: 03/15/2008, 4:15 PM |
|
Excellent, that worked perfectly.
Thanks for the help.
Pete
_________________
Pete
CCS 4
MySQL
PHP |
 |
 |
pbrad
Posts: 58
|
| Posted: 03/15/2008, 4:15 PM |
|
Excellent, that worked perfectly.
Thanks for the help.
Pete
_________________
Pete
CCS 4
MySQL
PHP |
 |
 |
|