CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Using Sothink Dhtmlmenu with CCS: Java trouble in includable file

Print topic Send  topic

Author Message
VBAjedi


Posts: 34
Posted: 02/11/2004, 1:25 PM

I'm trying to implement Sothink's Dhtmlmenu menu generation software with CCS. I created a static menu without any trouble, but can't seem to get a dynamic one (created on the fly from a mySQL table) to work. I'm using the instructions found here:
http://www.sothink.com/webtools/dhtmlmenu/store/phpdb/index.htm

The issue is that I need to include a Javascript in the header section of my page (so it can be referenced by a Javascript in the body section), but my page is the includable "Header" page in CCS (which doesn't have a header section).

Does anyone know where I can put the Javascript on the Header page so that it will be accessible by another Javascript in the body of the Header page? The line I need to place is:

<script type="text/javascript" language="JavaScript1.2" src="Menus/stm31.js"></script>

Also, has anyone else used Dhtmlmenu to dynamically generate menus in CCS? It looks like it could be a sweet solution if I could just get the hang of it. . .

_________________
VBAjedi
jedi at NOSPAM dot obie dot com
View profile  Send private message
VBAjedi


Posts: 34
Posted: 02/16/2004, 1:22 PM

For the record, I solved this one myself.

I modified the PHP/Java code output by Dhtmlmenu (to use the built-in connection object), then pasted it into the BeforeShow event. I used the event to write the entire chunk of generated Java (one line at a time, with all double-quotes escaped with a backslash) into a variable, then finished the event code with:
  
$Tpl->SetVar("JavaString", $JavaString);   
to bounce the Java out to the appropriate place in the HTML.

I now have drop-down menus as an include in my header that are created on the fly based on the current area of the site and the user's access level.

VERY nice! Dhtmlmenu (by Sothink) looks to be a useful tool for CodeCharge development.

VBAjedi
_________________
VBAjedi
jedi at NOSPAM dot obie dot com
View profile  Send private message
ed
Posted: 11/26/2004, 3:31 AM

Hi jedi,
trying your solution , not succeeded yet..
have you more info on :
- how to use the built-in connection object in instead of the sothink conn.
- BeforeShow event > from the page?
- Java (one line at a time ?

or maybe just a little bit more info ?

would be very greatfull , and yes Dhtmlmenu is very nice , would love to see it work with CodeCharge

Regards,
Ed,


menu
Posted: 11/30/2004, 7:39 AM

It works OK here
http://www.vision.to/new_cms/Common/index.php?pid=19&pmid=13

Martin K.
Posted: 12/05/2004, 10:34 AM

Hello and thanks for the Tip. Sothink.
I make a Grid (dhtml) with 1 Label Field (id), Content HTML.
In Before Show of the Labelfield i write this:

global $dhtml;
$ShownRecords = 0;
$Max_Show = 1000;
$platzhalter = ";";
if($dhtml->id > 0) { // Beginn
$db = New clsDBimmo_2004_enterprise();
// Begin Javascript
//Javascript
$datmenu = "<script id=\"Sothink Widgets:phpdb.pgt\" type=\"text/javascript\" language=\"JavaScript1.2\">\n".
"<!--\n".
"stm_bm([\"menu79af\",400,\"\",\"blank.gif\",0,\"\",\"\",0,0,250,0,1000,1,0,0])$platzhalter\n".
"stm_bp(\"p0\",[1,4,0,0,2,3,0,7,100,\"\",-2,\"\",-2,50,0,0,\"#fffff7\",\"#fffff7\",\"\",3,1,1,\"#000000\"])$platzhalter\n";

// Get Main Cat
$SQL = "SELECT * FROM enterprise_cat_main WHERE par_cat_id=0 AND lang_id=1 ORDER BY top";
$db->query($SQL);
$Result = $db->next_record();
if($Result && $ShownRecords < $Max_Show)
{
do {
$mainID = $db->f("cat_id");
$mainName = $db->f("cat_desc");
// Set MainCat
//Javascript
$datmenu .= "stm_ai(\"p0i0\",[1,\"" . $mainName . "\",\"\",\"\",-1,-1,0,\"\",\"_self\",\"\",\"\",\"\",\"\",0,0,0,\"arrow_r.gif\",\"arrow_r.gif\",7,7,0,0,1,\"#fffff7\",0,\"#b5bed6\",0,\"\",\"\",3,3,1,1,\"#fffff7\",\"#000000\",\"#000000\",\"#000000\",\"8pt Verdana\",\"8pt Verdana\",0,0])$platzhalter\n".
"stm_bpx(\"p1\",\"p0\",[1,2,0,0,2,3,0,0])$platzhalter\n";

$ShownRecords++;
// Get Subcat
$SQL2 = "SELECT * FROM enterprise_cat_main WHERE par_cat_id=" . $mainID . " AND lang_id=1 ORDER BY top";
$db2 = New clsDBimmo_2004_enterprise();
$db2->query($SQL2);
$Result2 = $db2->next_record();
if($Result2 && $ShownRecords < $Max_Show)
{
do {

$mainID2 = $db2->f("cat_id");
$mainName2 = $db2->f("cat_desc");
// Set SubCat
//Javascript
$datmenu .= "stm_ai(\"p1i0\",[1,\"" . $mainName2 . "\",\"\",\"\",-1,-1,0,\"" . $mainID2 . "\",\"_self\",\"" . $mainName2 . "\",\"\",\"\",\"\",0,0,0,\"\",\"\",0,0,0,0,1,\"#fffff7\",0,\"#b5bed6\",0,\"\",\"\",3,3,1,1,\"#fffff7\",\"#000000\",\"#000000\",\"#000000\",\"8pt Verdana\",\"8pt Verdana\",0,0])$platzhalter\n";

$ShownRecords++;
$is_next_record = $db2->next_record();
} while ($is_next_record && $ShownRecords < $Max_Show);
}
//Javascript
$datmenu .= "stm_ep()$platzhalter\n";
########################################################################################
$is_next_record = $db->next_record();
} while ($is_next_record && $ShownRecords < $Max_Show);
}
#############################################################################
//Javascript
$datmenu .= "stm_ep()$platzhalter\n".
"stm_em()$platzhalter\n".
"//-->\n".
"</script>\n";
$db->close();
$db2->close();
$dhtml->id->SetValue($datmenu);
} // End

It works fine.
By martin

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.