Reply LinkBack Thread Tools Search this Thread
Old 20-05-2004, 05:53   #1 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
php - div content replace

just thinking - its gonna be easier to be compliant with a bit of php rather then javascript. also, imo, javascript is a cock.

it'll be a div which has a few links at the top of it and each link changes the content of the div - content will either be a text listing or flash file. possible? pointers? thoughts?

***********************************************
** link1 - link2 - link3 - link4 - link5 **
***********************************************
** content here, here's the words **
** content here, here's the words **
** content here, here's the words **
** content here, here's the words **
** content here, here's the words **
***********************************************

thanks all.
  Reply With Quote
Old 20-05-2004, 05:54   #2 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,193
From mentioning JS, i'm assuming you're looking to refresh the content in the div without page loads? In which case it can't be done with PHP alone. Else it's pretty straightforward..
__________________
Random goodness at The Blog

  Reply With Quote
Old 20-05-2004, 05:58   #3 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
yep.

it can't? how about if the content is taken from an external xml file? 'call new data into this space' ?!

else pretty straightforward? how?
  Reply With Quote
Old 20-05-2004, 06:06   #4 (permalink)
cam
vague™
 
cam's Avatar
 
Join Date: Mar 2004
Location: Glasgow
Posts: 5,193
Sorry if that last post wasn't the clearest.

If you're wanting to change the content in the div, without reloading the entire page (e.g. a frame-like effect), then it's my understanding that it cannot be done using PHP alone - no matter the source. JS and Layers would be your friends here I assume, although it's not something i've done recently.

The "Else it's straightforward" was meaning if you were happy to accept the page-reloading each time the user clicked a link, as then it'd just be a standard php cms type affair.
__________________
Random goodness at The Blog

  Reply With Quote
Old 20-05-2004, 06:24   #5 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
cheers cam. but i'm sure there's gotta be a way round it.
  Reply With Quote
Old 20-05-2004, 06:33   #6 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,899
if you're gonna go for js, then I'd advise using a php fall-back so that users without js enabled can still get the content.
Basically create an accessible (possibly php in the url) link with a js override to offer dynamics to those who can support it and an accessible link to those who can't.

Belts 'n' braces, blah blah…


Alternatively, if the link2-link5 content is only supplimentary (i.e. non-critical) then use js to write in the links too.
That way, the links to the supplimentary content (2-5) are only offered to those who will be able to use them.
Essentials for everyone, full monty for js-enabled users (c.85%-90%)

-

I guess you could ask mik about what solutions Coldfusion might be able to offer.
  Reply With Quote
Old 20-05-2004, 06:42   #7 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Quick and dirty php option. the page reloads but you wouldn't really notice.

Code:
<ul> <li><a href="page.php?link=1">Link 1</a></li> <li><a href="page.php?link=2">Link 2</a></li> <li><a href="page.php?link=3">Link 3</a></li> <li><a href="page.php?link=4">Link 4</a></li> <li><a href="page.php?link=5">Link 5</a></li> </ul> <?php if(!isset($HTTP_GET_VARS['link'])){ $link = 1; } else { $link = $HTTP_GET_VARS['link']; } if ($link == 1) { echo "<p>Some text about link 1</p>"; } elseif ($link == 2) { echo "<p>Some text about link 2</p>"; } elseif ($link == 3) { echo "<p>Some text about link 3</p>"; } elseif ($link == 4) { echo "<p>Some text about link 4</p>"; } else { echo "<p>Some text about link 1</p>"; } ?>
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 20-05-2004, 06:47   #8 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,632
Quote:
Originally Posted by smallbeer
Quick and dirty php option. the page reloads but you wouldn't really notice.
That's what I thought. If you're just loading a bit of text or flash and the rest of the page is simply refreshing, the reload won't take long enough to worry about. Use php.
  Reply With Quote
Old 20-05-2004, 06:54   #9 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
hmm, the problem is that there's perl scripts also being executed on the page to include search results - each time the page refreshes, the scripts will re-execute which will slow things down. cheers though beers - useful elsewhere.
  Reply With Quote
Old 20-05-2004, 06:58   #10 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
What about this fusebox malarky? Mik swears blind in doesn't reload the page.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 20-05-2004, 06:58   #11 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,275
use php and the frigging method I keep telling people but they dont believe me. (fusebox) the page doesnt even reload just the content of the div.

it validates via strict and doesnt use flash.

I shall not explain agian
  Reply With Quote
Old 20-05-2004, 07:00   #12 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,275
Quote:
Originally Posted by smallbeer
What about this fusebox malarky? Mik swears blind in doesn't reload the page.

it doesnt. honest.
  Reply With Quote
Old 20-05-2004, 07:09   #13 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
but it reads like you have to re-build your site the fusebox way? you tried fusebox mik?
  Reply With Quote
Old 20-05-2004, 07:12   #14 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Have you read this brown?

Loading images into a page
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 20-05-2004, 07:17   #15 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
no, i hadn't seen it - will invetigate. my propblem is that i'm already passing vars to perl via the url - this is then gonna cause issues. i think. looking into it now.
  Reply With Quote
Old 20-05-2004, 07:44   #16 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,632
Quote:
Originally Posted by smallbeer
What about this fusebox malarky? Mik swears blind in doesn't reload the page.
Argued this - seems mik was right.

Not 100% sure yet, but I think:

If you put the fuseboxiness in your index page it will refresh (not reload) as it runs over the process, but if you outsource it to an external file, it'll act like an iframe. No refresh, no reload - just the include loads in.

See it working here: http://www.fusebox.org/

The variables in your urls will probably crap it up though.
  Reply With Quote
Old 21-05-2004, 04:30   #17 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
Quote:
Originally Posted by Stickman
Argued this - seems mik was right.
i don't belivit. he was too. that php thing works a treat (didn't go down the fusebox route but will remember its there) and we've solved the other issues of passing vars through urls.

good man mik. all that outsourcing paid off.
  Reply With Quote
Old 21-05-2004, 05:26   #18 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,275
cheek.
  Reply With Quote
Old 21-05-2004, 05:28   #19 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
hey, that was genuine gratitude. with a mild sprinkling of shock but none the less, gratitude. cheers mik.
  Reply With Quote
Old 21-05-2004, 06:05   #20 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,275
i know, i know. i forgot the wink
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8