Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Menus Without Javascript, Has PHP possibility to do it without JS
p_a
post Sep 23 2005, 09:09 PM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 23-September 05
Member No.: 12,187



I have many PHP Books, PHP Bible among others, but no clear description how to build menus (dynamic) Javascript like. Is PHP enough strong to do this? I also have Javascript Bible, many possibilities are usable within PHP pages.

Anybody has experience in creating dynamic menus in PHP?

Go to the top of the page
 
+Quote Post
moldboy
post Sep 24 2005, 12:03 AM
Post #2


Privileged Member
*********

Group: Members
Posts: 516
Joined: 29-April 05
From: Canada Eh?!?
Member No.: 6,408



How do you mean dymanic? if you mean like the mouse over and display alternate options, then I really don't think so, that is a javascript, dhtml, css, or flash relm, something client side, the only way a mouse over menu would work with php is if by some action you could submit the page on mouseover and return new results, but taht wouldn't be efficeant.

Besides the very name, PHP bible, probably wouldn't tell you how to do something with Javascript if it could be done with PHP.
Go to the top of the page
 
+Quote Post
arboc7
post Sep 24 2005, 12:20 AM
Post #3


Advanced Member
*******

Group: Members
Posts: 123
Joined: 5-September 05
Member No.: 11,522



You cannot create any dynamic menus using PHP because it executes on the server, not at the client. JavaScript executes on the client-side, so much more dynamicity is available. A few people have figured out how to create multi-level "pop-out" menus using CSS, and if you want to find that, just google it!

Sorry that you can't use PHP for your menus...
Go to the top of the page
 
+Quote Post
Spectre
post Sep 24 2005, 06:47 AM
Post #4


Privileged Member
*********

Group: Members
Posts: 873
Joined: 30-July 04
Member No.: 246



You can use PHP to send the HTML/DHTML/JavaScript/whatever code to the client. The dynamic generation could be done with PHP to change the entries the menu contains, for example. The actual menu would be constructed using, most likely, a combination of HTML and JavaScript. I don't know why anyone would want to do this - menus are usually a static method of travelling around a web site.

Such as:
CODE
<?php
echo '<whatever>' . date('M jS') . '</whatever>';
?>
Go to the top of the page
 
+Quote Post
p_a
post Sep 24 2005, 09:13 AM
Post #5


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 23-September 05
Member No.: 12,187



Javascript is, of course, very usable. I used even few Javascript menu generators. But, sometimes I would like to do something like this: I have a website with, for example 10 webpages. I want to have the same header and footer at all of them. I make pages, and include the header.php at the top, and the footer.php at the bottom. Javascript menu is in the header.php. Menu is simple, and complete inside one function. When I started website from initial index.something (may be .php or .html) I do not see the header at all (even it's included). The most interesting thing is the fact: I save the Javascript function to the .js file, I put the line of code where I am calling the .js from header.php, and - everything works! Why?

Where is the problem? It has to work both ways by any logic! Because it's the same thing. Or it is not.
Go to the top of the page
 
+Quote Post
Amezis
post Sep 24 2005, 01:52 PM
Post #6


Privileged Member
*********

Group: Members
Posts: 535
Joined: 14-February 05
From: Oslo, Norway
Member No.: 3,759



Your server probably don't support PHP scripting, so none of your PHP scripts will work.
PHP, ASP etc are server-side scripts, so the programs to run the scripts has to be installed on the server.

Javascript is a browser-side scripting language, so it will work as long as the browser supports it.

If, you get hosted here on Trap17, your PHP scripts will work.
Go to the top of the page
 
+Quote Post
p_a
post Sep 24 2005, 08:59 PM
Post #7


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 23-September 05
Member No.: 12,187



I can see the complete page with header and footer included.

Problem is the menu in header.

If the Javascript code function is inside the header.php it will not work, it will not be visible in the webpage. If it is outside header.php as, for example menu.js, I just put the ordinary code to call the Javascript from header.php, it works perfect.

Go to the top of the page
 
+Quote Post
sobhan
post Oct 2 2005, 02:13 PM
Post #8


Newbie [Level 1]
*

Group: Members
Posts: 21
Joined: 1-October 05
Member No.: 12,412



I tink you can use Java n PHP. But i am not shure. Like this

<?php

print_f
'<html><head><script laguange="javascript"....></script></head></html>';


?>
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Javascript To Php - A Few Questions(1)
  2. Javascript And Php(6)
  3. Building A Chat Using Javascript, Php, And Ajax(2)
  4. Can I Make Dynamic Menu In Php(7)


 



-