Jump to content

Need help with PHP please


karimali831

Recommended Posts

I'm new to this and need help with 2 things.

You'll maybe not understand, hope you do though

 

1)

 

I setup a website @ http://team-300.net/templates/1/index.php and for any php page I create it would show the contents of the first page from http://team-300.net/templates/1/index.php?site=news and for example, if I do create a link "awards.php" http://team-300.net/templates/2/index.php?site=awards would still point to index.php?page=news showing the contents of that page (No redirection) the page itself

 

2)

 

Also have 5 designs of that website, trying to show the contents of news.php for each news.php for each design e.g. http://team-300.net/templates/1/index.php?page=site the same as http://team-300.net/templates/2/index.php?page=site

I have no clue of doing this, seems a little complicated. I do not want to do this manually for each theme as this will take very long and as I know there's another way but I just don't know how

 

I can't point http://team-300.net/templates/2/index.php?page=news to templates/1/index.php?page=news as it would show template 1 and can't do the same for templates/2/index.php?page=news to point to templates/1/news.php as this will just show the contents, not the design/index.php iteslf.

 

Also, try not to comment on frames if you can BUT if that's the only way, then I got no choice.

 

Yeah, problem 1 is the main thing so if you can help I'll appreciate it.

 

Thanks!

Karim

Link to comment
Share on other sites

Please post your code (if any).

 

It sounds to me like you want include("$page.php"); (after verifying that the value of $page is allowed).  I'm having trouble understanding your question 1 though.

 

For question 2, you can have a default template directory, and have your scripts use that if they cannot find a specific template.  Is that the kind of thing you're looking for?

Link to comment
Share on other sites

I'll try explain 1 again with codes.

 

I am able to use this fine ->

<td width="196" height="42" valign="top"><? include("sc_files.php"); ?></td>

BUT When using this code, it doesn't work. The "index.php?site=gallery will just point to the homepage.

 

<a href="index.php?site=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image41','','Bilder/gallery1_47.jpg',1)"><img src="Bilder/gallery_47.jpg" name="Image41" width="167" height="15" border="0"></a></td>

 

I tried

 

<? include("sc_files.php"); ?><onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image41','','Bilder/gallery1_47.jpg',1)"><img src="Bilder/gallery_47.jpg" name="Image41" width="167" height="15" border="0"></a></td>

 

But I know this is soo wrong

Link to comment
Share on other sites

i believe your coding structure will be ugly using your logic..

any ways heres how

example you have a url formated this way

http://team-300.net/templates/2/index.php?page=news

and you wan the page to got to news..page

swithc($_GET['page']){
  case 'news':
     header('location: news.php');
     exit;
  break;
case 'articles':
     header('location: articles.php');
     exit;
  break;
}

 

or maybe what you mean is include what is on the querystring

 

something like

swithc($_GET['page']){
  case 'news':
     include 'news.php';
     exit;
  break;
case 'articles':
     include 'article.php';
     exit;
  break;
}

 

does it make sense ?

 

 

 

Link to comment
Share on other sites

Where can I get help elsewhere then? My topic is already on the second page.

 

When you start paying us for advice, that's when we start delivering on time :)  Until then, be happy that we even respond.

 

Teng's code looks good.  Once you've solved 1 with that, you might find the solution to 2 is clear.

 

Oops, teng that is "switch" not "swithc" :P

Link to comment
Share on other sites

The advice is free, but it doesn't come fast.  I only check this site once a day (unless I've got nothing else to do), so you can expect 24 hours between each response from me.

 

If you want someone to write code for you, then you can make an offer in the freelancing section of the forum.

 

Regarding "include", what it does is add another page into your page as if it had been called directly.  It's often used to choose between different pages based on a GET value, as in teng's second example.  If you haven't already, you can try out his code and see what it does.  You'll need to have news.php and article.php in the same place as index.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.