Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Ajax And Php Script Advice

This is a discussion on Ajax And Php Script Advice, within the PHP section. This forum and the thread "Ajax And Php Script Advice" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Ajax And Php Script Advice
Webmaster
post Feb 18 2008, 03:36 PM
Post #1


New Squeeze
*

Posts: 2
Joined: 14-February 08


Hi all, this looks like a real cool forum!!.

I have a database that I use to build a menu which one can use to download stuff in the database

item#
download1
download2
download3
item#2
download1
download2
download3
item#3
download1
download2
download3

This struture takes up a lot of space and I would like to use ajax do that the downloads are collapsed like so but expand when user clicks on them.

item#
item#2
item#3

Is it possible to generate all this with the ajax functionality?


--------------------
Vēnī, vīdī, vīcī
Go to the top of the page
 
+Quote Post
rewake
post Feb 18 2008, 04:33 PM
Post #2


Rapid Squeezer
Group Icon

Posts: 239
Joined: 14-February 08
From: NY, USA


Hi,

Yes, you can use Ajax to call the data for the sub-menu, but it may not be a good idea in terms of usability considering that the user would need to wait for the menu to open. There is also the possibility you may run into errors and the sub menu will not show at all. (It would necessary to program something to accommodate this.)

Here's the overview...

1. Create a PHP function that queries your database to get the sub-menu data for the selected menu.
2. Create an Ajax script to call the PHP script and get the sub-menu data.
3. Create a JS script to display the sub-menu.

That's the quick version obviously!

Rich


--------------------
QUOTE
if ($name=='will') echo '/(bb|[^b]{2})/';

Raineri Jewelers | MySpace | Facebook | deviantART
Go to the top of the page
 
+Quote Post
christopher
post Feb 18 2008, 08:09 PM
Post #3


Squeezing
***

Posts: 54
Joined: 15-February 08
From: Ottawa, Canada


I wouldn't use PHP and AJAX for this. Instead:

  1. Define the full expanded list in the markup.
  2. Use CSS to hide the sub-parts by default.
  3. Use JavaScript to toggle the style of the sub-parts (display: block vs display: none)


--------------------
Blog: annoyed.ca | Web Site Hosting: www.bluephyre.com
Go to the top of the page
 
+Quote Post
Jason
post Feb 19 2008, 03:35 AM
Post #4


Master of the Universe
Group Icon

Posts: 1,298
Joined: 15-February 08
From: London, England


I agree somewhat with christopher. However you can still use php to generate the menu links. If you are creating or using a content management system then you will probably need to use php to gather links and sub menu's for your navigation.


--------------------
Go to the top of the page
 
+Quote Post
Monie
post Feb 25 2008, 03:00 AM
Post #5


Squeeze Machine
*****

Posts: 733
Joined: 13-February 08
From: Borneo


I think CSS and JavaScript will save you day on this biggrin.gif
Check out this video tutorial from sampsonvideo.com!


--------------------

Go to the top of the page
 
+Quote Post
thesealportaltea...
post Feb 25 2008, 08:54 AM
Post #6


Rapid Squeezer
****

Posts: 218
Joined: 14-February 08
From: Currently loacted in bustle of vurtual servers hosted by GoDaddy.com.


Unless that database changes frequently, or you have role/user-based navigation.
Then you would have ajax or PHP build the menu and use CSS to hide parts and format the menu.


--------------------
We are sorry but complaint.hell is not registered to Heaven Inc.
TheSealPortal.com - Yea, we are celebrating are 200th post at TWS. Everybody Party.
Go to the top of the page
 
+Quote Post
rich97
post Aug 27 2008, 12:25 PM
Post #7


Rapid Squeezer
Group Icon

Posts: 261
Joined: 27-August 08
From: London, UK


The CSS way works if you are only using mouseover but if you want a drilldown menu like on deviantart (where you have to click to drill down the categories) then you would most definatley have to use javascript/php ( ajax wink.gif ).

Of cource you would need to provide some sort of alternative navigation or inform your user that javascript is required. Personally I dont bother any more with alternatives (many sites don't), I just throw up a polite error message. That said, what you should do is make sure the HTML is avalible in the document (just use javascript to control the CSS and transition effects, if any).

Out of interest does google index elements that are set to display:none?


--------------------
Go to the top of the page
 
+Quote Post
rich97
post Aug 27 2008, 12:40 PM
Post #8


Rapid Squeezer
Group Icon

Posts: 261
Joined: 27-August 08
From: London, UK


Oh and I'd use jQuery/Prototype & Scriptauclous if you dont mind the extra script for user to download. It makes thing a lot easier in terms of DOM manipulation.

For somthing basic like this I'd use jQuery concidering is much more lightweight.


--------------------
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   9 PoetAlley 397 17th February 2008 - 06:27 PM
Last post by: PoetAlley
No New Posts   1 gribble 364 5th March 2008 - 06:08 PM
Last post by: delusion
No New Posts   0 Ryan 358 7th March 2008 - 07:39 AM
Last post by: Ryan
No New Posts   1 gribble 230 26th March 2008 - 03:59 AM
Last post by: c010depunkk
No New Posts   13 JustinStudios 343 13th March 2008 - 11:51 AM
Last post by: velo