Lux Posted May 19, 2010 Report Share Posted May 19, 2010 Hi! I'm obviously building a website & running into some issues and I was wondering if someone more experienced than me could help me out. I'll try and explain. There is one file that contains the layout for my website & some other important things as well (divs, spans, whatever). It's currently linked to a SMF forum, which is going fairly well provided that I want to code pages that pull data from the forum & print it somewhere else. However, now I've reached the point where I'd like to make a custom SSI page with independent data (in this case, character reference sheets for a comic) that I'd like to be printed on-demand, preferably by clicking a link (my current solution is a bit... what shall we say? Heavy. You can see how it looks here: http://wolflux.net/ae/chars.php'>http://wolflux.net/ae/chars.php ). For instance, let's say I have the following code in my SSI: <?php function characterOne(){ code here } function characterTwo(){ code here } This is all good and well, but it does not make it any easier on me, other than ensuring that the information is not printed unless called. I want to associate each function of the SSI to something clickable (like the headshots in my current workaround here: http://wolflux.net/ae/chars.php - sorry for any layout position errors, btw. I'm working on it.) that will update the content zone (or whereever on that page I'd like it to display) so that it shows ONLY the information from the function that was called. If that makes sense. I've been looking into making proper dynamic PHP pages, but quite frankly I am a complete newbie at MySQL (ESPECIALLY queries) and every tutorial I've found on it were either incomplete or didn't break it down enough for me to understand. I'm therefore looking for alternatives. Now, there's a problem with the SSI too. Obviously, the SSI data is still being loaded into the browser, even though it isn't shown, which I also don't want it to do. If possible, I want the data in the functions to be ignored unless they're called. This is also why I don't think using #-values with SPANs would be the solution I'd want either, as the data is still loaded - just not visible. There's probably a simple solution for it, but after a few months of trial and error plus a few days of Googling I've given up trying to find one. (Note: I'd also prefer to use as few javascripts as I possibly can; there's already a JS tooltip & an overlay script running & though those are fairly lightweight I normally consider JS a bad thing - especially for a website aiming for a simple & efficient, yet pretty style & low loading times.) Now, a monkey could probably explain it better than me because I suck in the communication department, but I hope I managed to at least give you an idea of what I'd like to do. Hopefully. If there's a need for some of the site's code, state what you want & you'll have it. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
is_numeric Posted May 20, 2010 Report Share Posted May 20, 2010 contact me regarding your problem here I need to understand it better Quote Link to comment Share on other sites More sharing options...
Lux Posted May 22, 2010 Author Report Share Posted May 22, 2010 I'll try and expand on what I need. The code I am using right now is a bit complicated in execution. The first page, chars.php is holding the layout & calling all content from SSI's: swiped What this does is that it runs javascript code for the tooltips before ending HTML & preparing the website content in a PHP function that will be called from "chars.php". This produces a bunch of headshots that each open an overlay frame (lytebox) when clicked on that shows a page in an iframe with the character details. This doesn't work well in every browser! Instead of that system, though, I'd like a script that will allow me to simply add a ?something after "chars.php" (it'll look like: chars.php?something) in order to pull content from a file (that's preferably not a SSI) & then print it out in a DIV. I'll try to draw out an example: http://website/chars.php: HOME CHARACTERS div | V _____________________________ | | | | | | | CONTENT 1 | | | | | | | | | |___________________________| When a user opens the "chars.php" page (CHARACTERS), CONTENT 1 displays. CONTENT 1 includes headshots of each character & the javascript tooltip. When the user clicks a headshot in CONTENT 1, though, it would lead to http://website/chars.php?kyle'>http://website/chars.php?kyle . This would query a separate PHP page (not SSI) called "chardesc.php" for a function called "kyle();". If that function exists there, the information inside it would be taken by chars.php & then echoed inside a DIV with the ID "char". So now that the address is http://website/chars.php?kyle , the page should look like this: HOME CHARACTERS div | V _____________________________ | | | | | | |KYLE'S CHARACTER | | DESCRIPTION | | | | | | | |___________________________| Similarly, chars.php?anima would pull any content inside the function "anima();" defined in "chardesc.php", etc. When visitors' url changes back to "http://website/chars.php", the DIV would show CONTENT 1 again. Am I making any sense? *edit* Silly thing ruined it >: Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 22, 2010 Report Share Posted May 22, 2010 Sounds like you could do something like this: This assumes that the URL would look like this: chars.php?yourcharacter, and each character has an associated function that would display their div of information. Within the chars.php page where you want your content to change with the different character's information, you would do something like: <?php if (isset($_GET['kyle'])) { kyle(); // (would display if URL was "chars.php?kyle") } else if (isset($_GET['yourcharacter'])) { yourcharacter(); // (would display if URL was "chars.php?yourcharacter") } else { ...the default information that appears if the URL is just "chars.php", or if it is a character that doesn't exist... } ?> You could also do something similar where the data is pulled from a database depending on the variable that is set in the URL. Quote Link to comment Share on other sites More sharing options...
Lux Posted May 22, 2010 Author Report Share Posted May 22, 2010 Very simple. I think that's exactly what I needed! Thank you very much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.