Jump to content


Photo

.php?=content


  • Please log in to reply
7 replies to this topic

#1 chrisjunkie

chrisjunkie
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 March 2006 - 02:23 AM

I didnt know what to search for but i want to change [a href=\"http://sitename/content/womd/index.html\" target=\"_blank\"]http://sitename/content/womd/index.html[/a] to [a href=\"http://sitename/content.php?=womd\" target=\"_blank\"]http://sitename/content.php?content=womd[/a] but i do not know how!


ANY HELP GREATLY APPRECIATED!!!

#2 phporcaffeine

phporcaffeine
  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 22 March 2006 - 03:53 AM

I assume that you are talking about:

User clicks a link and takes them to point A but you want the address bar to read as if it took the user to point B?

PHP doesn't have the ability to do this. You would want to look into Apache's mod_rewrite, but I don't know that it would help much since your rerwite needs to rewrite with a populated variable.
Thanks,

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com

#3 chrisjunkie

chrisjunkie
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 March 2006 - 05:07 AM

[!--quoteo(post=357192:date=Mar 22 2006, 03:53 PM:name=phpORcaffine)--][div class=\'quotetop\']QUOTE(phpORcaffine @ Mar 22 2006, 03:53 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I assume that you are talking about:

User clicks a link and takes them to point A but you want the address bar to read as if it took the user to point B?
[/quote]

Thanks for the reply but i want to do something similar to phpnuke. When you type [a href=\"http://sitename/modules.php?name=downloads\" target=\"_blank\"]http://sitename/modules.php?name=downloads[/a] it takes you to /modules/Downloads/index.php How do i do this?

Cheers
Chris


#4 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 22 March 2006 - 05:36 AM

here, this code will get you going in the right direction..


make this content.php

<?php
$content = $_GET['content'];

if($content == "womd"){
    include("http://sitename/content/womd/index.html"){
}
else{
    echo "Sorry, unknown content view specified!";
}
?>

then go to content.php?content=womd to test :)

#5 chrisjunkie

chrisjunkie
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 March 2006 - 05:51 AM

Thanks! but i want multiple content so how would i intergrate the example below

$content="content/$name/index.html"

$name might be womd

#6 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 22 March 2006 - 06:58 AM

Like this:

<?php
$name = $_GET['name'];

$content ="content/$name/index.html"

if($name){
    include($content){
}
else{
    echo "Sorry, unknown name specified!";
}
?>

Make that content.php and do this: content.php?name=womd to test

#7 chrisjunkie

chrisjunkie
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 March 2006 - 07:10 AM

Thanks prismatic that is EXACTLY what I was looking for!
Thanks again, Chris

EDIT: It doesnt work :( WHATS WRONG? :'(

#8 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 22 March 2006 - 09:52 AM

[!--quoteo(post=357215:date=Mar 22 2006, 02:10 AM:name=chrisjunkie)--][div class=\'quotetop\']QUOTE(chrisjunkie @ Mar 22 2006, 02:10 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Thanks prismatic that is EXACTLY what I was looking for!
Thanks again, Chris

EDIT: It doesnt work :( WHATS WRONG? :'(
[/quote]


Oops, forgot a ; at the end of this line >> $content ="content/$name/index.html"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users