473,388 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

embedded links with php

14
hello,

is it possible to do embedded links from a php script?

Check out the code below, when I send the test case to the switch, it will not go to the embedded link #clarence2

Any thoughts?

Thanks,
Tim

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $location=$_GET['location']; if (empty($location)) { $location='index'; } changelocation($location); function changelocation($location) { include ('header.php'); echo '<table align="center" border="0" cellpadding="0" cellspacing="0" width="750">';echo '<tr>';echo '<td width="750"  align="center" valign="top">';
  4.  
  5. switch ($location) 
  6. {
  7. case 'index':
  8. include ('home.php'); break; 
  9.  
  10. case 'artists':
  11. include ('artists.php'); break; 
  12.  
  13. case 'artwork':
  14. include ('artwork.php'); break; 
  15.  
  16. case 'location':
  17. include ('location.php'); break; 
  18.  
  19. case 'contact':
  20. include ('contact.php'); break; 
  21.  
  22. case 'aboutus':
  23. include ('aboutus.php'); break;
  24.  
  25. case 'test':
  26. include ('http://www.hermitagegallery.com/artists/test.php#clarence2'); break; 
  27.  
  28. } include ('footer.php'); }
  29. ?>
  30.  
Oct 2 '07 #1
5 1548
ak1dnar
1,584 Expert 1GB
Sorry you can't call for a "onpagelink" or "bookmarks" on the page, but the main page will display. if you need to display the page with the onpage link use headers
Oct 2 '07 #2
Motoma
3,237 Expert 2GB
Let me step back and explain a little about the way includes work:

The moment the PHP interpreter encounters and include statement, the PHP interpreter stops processing the current PHP page, and begins executing the code located in the included file. An easy way to imagine this is to say that the entire body of code located in the included PHP file is copied and pasted at that exact point in the code where the include statement is located.

When you call and Include statement, you are not directing the browser; everything happens server-side, and the end user remains at the parent page.

As my compatriot ajaxrand stated, the proper way to redirect a user is to issue a header() call. The only caveat of doing so is that you cannot print any HTML before doing so.
Oct 2 '07 #3
sickboy
14
So this will not work then right? Or do I need to move my switch statement around?

I get what your saying but if I just have a redirect statement from a header statement, it will just redirect me to the page I specify without mainting the php script I use for the index, to put my own Header.php and Footer.php files below

just a little lost with headers, since I can get them to work if I put a header redirect before all the code, but it does not maintain the code.

Thanks!
Oct 2 '07 #4
sickboy
14
Not sure if headers are going to do what I need. Basically I need to have a case call the page but go to a bookmark/embedded link in the page (mainly cause I am going to have a page for one artist, but some artists have multiple art pieces, so I need an embedded link so on the art page, when they click on a specific piece of art, it takes them to that embedded link, not just the top of that page). I need to be able to display a Header.php (links and toolbar) before I run switch statement, which in turn means html is already ran defeating the header statement and getting me an error.
Oct 2 '07 #5
sickboy
14
I think I may have a solution.

For every piece of art, I will create seperate pages. When someone wants to view all the art created by an artist by clicking the link, within the switch case for that artist, I will have a new include for each piece of art.

Under the art section, when they want to view just one piece of art, i will have a seperate switch statement just for that piece of art.

So the art wont be all on one page for each artists, so I wont need to use embedded links or header()s.

Any thoughts if this is a bad idea?

Thanks!
Oct 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Vio | last post by:
Hi, I've been trying to embed (statically) wxPy alongside an embedded py interpreter on a linux/gtk box. At one point, for some reason misc.o linking reported "multiple definitions of...
3
by: max khesin | last post by:
There has been a long argument as to whether high link density is good for the users. Some say it is, as it contains more information, the others say it is confusing. There is statistical study...
2
by: fotis | last post by:
hello there! I am playing with embedded python these days. I wrote sth like this: ------------------------------ Code ------------------------------- #include <Python.h> #include <iostream>...
1
by: unotin | last post by:
I have an application in ASP that exports to Word using the Response.ContentType method. The application references another ASP page through the img tag that uses a Response.BinaryWrite (of an...
1
by: Chris Stephens | last post by:
The Spring 2004 copy of our Embedded Development Tools Newsletter is now available for downloading from our web site It includes information about...... An affordable USB protocol Analyser ...
0
by: Vladi | last post by:
Hello everybody, I have a asp.net 1.1 page which has the following controls: 4 Images whose src points to an image.aspx file which returns a different jpg from a DB 1 flash object on top of those...
0
by: SAL | last post by:
Has anyone created Embedded Links programmatically before? I have a VB.net and ASP.net Web Application developed in VS.net 2003. What I am trying to do/find is information on how to create an...
5
by: iegeek | last post by:
Hi all, I know this is a well-worn topic, but in viewing multiple posts and articles, I still can't find a satisfactory answer. I have embedded html in an xml file (element data, not attributes)...
1
by: Beowulf | last post by:
I inherited an existing database application about 6 months ago. I've finished converting it to use SQL Server 2000 as the backend (MS Access 2002 frontend w/ Userforms+VBA code pointing to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.