/    Sign up×
Community /Pin to ProfileBookmark

help with php file arrays

hiya,

i am working on a current project which i could do with a hand with ?

i have a products page with menus which expand and close on the right using jquery also when clicking on a submenu it executes a jquery script which changes the content of the div on the right to reflect the menu clicked on.

now with 12 products each with their own little blurb of text and pictures,
having them all listed (styled to be hidden untill called by my jquery script), i was worried that the page size was going to start to become a little to large,

so i starting thinking about external files with the content of the div and how i could get the content inside the div using php.

basically this is what i have come up with:

at the top of the page i have:

[code=php]<?php
$contentFile1 = “Products/Cat5.php”;
$content =file(“$contentFile1”);

?>
[/code]

then i have down the page the div which is hidden untill called by the jquery and inside of the div i have this:

[code=php] <div style=”display: none;” class = “type” id = “net-1-content”>
<?php Echo $content[0]; ?>
</div>[/code]

now i did have it display something which was in the Cat5.php,

but as soon as i started to try to make it show more of that file it didnt like it and it now displays nothing…..

can anyone please tell me if i am thinking about this correctly, and the last thing, i have a feeling that when the page loads its going to load all the div contents into the file array which is going to increase the page size anyway so this might be a pointless exercise

thanks for any help at all

Vade

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiMar 10.2009 — As you are using jQuery, I'd take advantage of it's ajax functionality and send a request to a script which returns the appropriate x products based on the link clicked by the user.

Your current approach is not really any different than just listing the content directly as the php is all executed server-side before the page is sent to the browser.
Copy linkTweet thisAlerts:
@VadeauthorMar 10.2009 — As you are using jQuery, I'd take advantage of it's ajax functionality and send a request to a script which returns the appropriate x products based on the link clicked by the user.

Your current approach is not really any different than just listing the content directly as the php is all executed server-side before the page is sent to the browser.[/QUOTE]


thanks for the quick response,

but i dont suppose you could by any chance give me an example of how this would look?

i basically had to try learning Jquery from scratch last night ( up till 3am doing it) and i havent used Ajax before... i am a faster learner tho.

in case you want to see the page in action, http://voicepath.tiger24.com/products2.php

thanks again

Vade
Copy linkTweet thisAlerts:
@VadeauthorMar 10.2009 — found this tutorial:

http://visionmasterdesigns.com/tutorial-ajax-interface-menu-using-jqueryphp/

thinking i might be able to do something using that
×

Success!

Help @Vade spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...