Jump to content

What have I done now!!! Everything is a link!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
domestic

domestic

    Learning Programmer

  • Members
  • PipPipPip
  • 44 posts
Ok, while making changes to the site, I implemented some code to detect where the vewer is and then, based on this information, choose which images it should show, so that your location is hightlighted. Anyways, after implementing this, every single word now links to a page "about" unless it already has a link. Why? What have I done wrong this time? Oh and the "about" page doesn't exist yet.

Website: ASR Demo V2 - home

navbar.html
<html>

<style type="text/css">

<!--

.txtbody {

	font-family: Calibri, Arial;

}

-->

</style>



<div align="center" class="txtbody">


<?php

  $page=$_GET['location']; if (empty($page)) {

    $page='home';

  }


  if (substr_count($page, "home")){

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=home"><img src="../Pictures/NavHome1.jpg" alt="Home" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=listen"><img src="../Pictures/NavListen0.jpg" alt="Listen" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=schedule"><img src="../Pictures/NavSchedule0.jpg" alt="Schedule" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=news"><img src="../Pictures/NavNews0.jpg" alt="News" width="95" BORDER=0 height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=contact"><img src="../Pictures/NavContact0.jpg" alt="Contact" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=about"><img src="../Pictures/NavAbout0.jpg" alt="About" BORDER=0 width="95" height="30">';

  } else if (substr_count($page, "listen")){

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=home"><img src="../Pictures/NavHome0.jpg" alt="Home" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=listen"><img src="../Pictures/NavListen1.jpg" alt="Listen" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=schedule"><img src="../Pictures/NavSchedule0.jpg" alt="Schedule" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=news"><img src="../Pictures/NavNews0.jpg" alt="News" width="95" BORDER=0 height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=contact"><img src="../Pictures/NavContact0.jpg" alt="Contact" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=about"><img src="../Pictures/NavAbout0.jpg" alt="About" BORDER=0 width="95" height="30">';

  } else if ((substr_count($page, "schedule"))||(substr_count($page, "shows"))){

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=home"><img src="../Pictures/NavHome0.jpg" alt="Home" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=listen"><img src="../Pictures/NavListen0.jpg" alt="Listen" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=schedule"><img src="../Pictures/NavSchedule1.jpg" alt="Schedule" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=news"><img src="../Pictures/NavNews0.jpg" alt="News" width="95" BORDER=0 height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=contact"><img src="../Pictures/NavContact0.jpg" alt="Contact" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=about"><img src="../Pictures/NavAbout0.jpg" alt="About" BORDER=0 width="95" height="30">';

  } else if (substr_count($page, "news")){

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=home"><img src="../Pictures/NavHome0.jpg" alt="Home" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=listen"><img src="../Pictures/NavListen0.jpg" alt="Listen" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=schedule"><img src="../Pictures/NavSchedule0.jpg" alt="Schedule" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=news"><img src="../Pictures/NavNews1.jpg" alt="News" width="95" BORDER=0 height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=contact"><img src="../Pictures/NavContact0.jpg" alt="Contact" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=about"><img src="../Pictures/NavAbout0.jpg" alt="About" BORDER=0 width="95" height="30">';

  } else if (substr_count($page, "contact")){

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=home"><img src="../Pictures/NavHome0.jpg" alt="Home" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=listen"><img src="../Pictures/NavListen0.jpg" alt="Listen" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=schedule"><img src="../Pictures/NavSchedule0.jpg" alt="Schedule" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=news"><img src="../Pictures/NavNews0.jpg" alt="News" width="95" BORDER=0 height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=contact"><img src="../Pictures/NavContact1.jpg" alt="Contact" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=about"><img src="../Pictures/NavAbout0.jpg" alt="About" BORDER=0 width="95" height="30">';

  } else if (substr_count($page, "about")){

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=home"><img src="../Pictures/NavHome0.jpg" alt="Home" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=listen"><img src="../Pictures/NavListen0.jpg" alt="Listen" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=schedule"><img src="../Pictures/NavSchedule0.jpg" alt="Schedule" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=news"><img src="../Pictures/NavNews0.jpg" alt="News" width="95" BORDER=0 height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=contact"><img src="../Pictures/NavContact0.jpg" alt="Contact" BORDER=0 width="95" height="30"></a>';

    echo ' <a href="http://www.abdn.ac.uk/~u41am6/ASR/PHP2/index.php?location=about"><img src="../Pictures/NavAbout1.jpg" alt="About" BORDER=0 width="95" height="30">';

  }

?>


</div>

</html>

index.php
<noscript>

<meta http-equiv="refresh" content="2; URL=enable_javascript.php">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

<meta name="Keywords" content="Student radio, Aberdeen Student Radio, Online radio station, free radio">

<meta name="description"content="Aberdeen Student Radio is the new radio sation designed purely for students, playing what you want to hear">

<meta name="distribution" content="Global" >

<meta name="rating" content="Safe For Kids">

<meta name="copyright" content="Aberdeen Student Radio">

<meta name="Expires" content="never">

</noscript>


<?php


/* Aberdeen Student Radio demo page version 2

   Designed and maintained by Andrew MacKillop

   Copyright Andrew MacKillop 2007

 */


//get current location. if null then goto home page

$location=$_GET['location']; if (empty($location)) {

  $location='home';

}


changelocation($location);


function changelocation($location) {


//include the starting tags

include ('header.html');




//Top

echo '  <table width="1000px" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">';

echo '  <tr>';

echo '    <td colspan="3" align="bottom" valign="bottom" height="100">';

echo '      <p><font size="20pt" face="Base 02">';

echo '        <img src="../Pictures/ASRBarL.jpg" width="180" height="100"><img src="../Pictures/ASRBarM.jpg" width="640" height="100"><img src="../Pictures/ASRBarR.jpg" width="180" height="100">';

echo '      </font></p>';

echo '    </td>';

echo '  </tr>';

  

//Left

echo '    <td width="200px" colspan="1" align="center" valign="top" bgcolor="#f0f0f0">';

echo '      <div align="left"><font face="Calibri">';

              require_once ("pane_left.html");

echo '      </font></div>';

echo '    </td>';



//Main section

echo '    <td width="600px" align="center" valign="top">';

echo '	    <div align="center" valign="top">';

              require_once ("navbar.html");

echo '      <br /></div>';

echo '      <div align="left"><font face="Calibri">';

              $newlocation = $location.".html";

              require_once ($newlocation);

echo '      </font></div>';

echo '    </td>';



//Right

echo '    <td width="200px" colspan="1" align="center" valign="top" bgcolor="#f0f0f0">';

echo '      <div align="right"><font face="Calibri">';

	 		  require_once('pane_right.html');

echo '	    </font></div>';

echo '    </td>';

echo '  </tr>';



//Bottom left

echo '  <tr>';

echo '    <td align="center" valign="top" height="5" bgcolor="#f0f0f0">';

echo '      <a href="http://www.ausa.org.uk/"><img src="../Pictures/AUSA.gif" alt="ASR" width="50" height="52" align="absmiddle"></a>';

echo '    </td>';



//Bottom middle

echo '    <td align="center" valign="baseline" height="52">';

echo '    </td>';



//Bottom right

echo '    <td align="center" valign="top" height="5" bgcolor="#f0f0f0">';

echo '    </td>';

echo '  </tr>';




//Bottom Curve - left

echo '  <tr>';

echo '    <td align="center" valign="bottom" height="22" bgcolor="#ffffff">';

echo '      <img src="../Pictures/SideBarB.jpg" width="200" height="22"></a>';

echo '    </td>';



//Bottom middle

echo '    <td align="center" valign="baseline" height="22">';

echo '      <div align="center"><font face="Calibri, Arial"><a href="http://www.abdn.ac.uk/~u41am6">Designed by Andrew MacKillop</a></font></div>';

echo '    </td>';



//Bottom right

echo '    <td align="center" valign="bottom" height="22" bgcolor="#ffffff">';

echo '      <img src="../Pictures/SideBarB.jpg" width="200" height="22"></a>';

echo '    </td>';

echo '  </tr>';




//End of table

echo '</table>';


switch ($location) {

  case 'index': 	require_once ('home.html');

    break;

  case 'contact': 	require_once ('contact.html');

    break;

}


echo '</td></tr></table>';


include ('footer.html');


}


?>


<!-- Start of GoogleAds Code -->


<div align="center">

<script type="text/javascript"><!-- 

google_ad_client = "pub-7130529620454718";

//468x60, created 05/11/07

google_ad_slot = "9601968780";

google_ad_width = 468;

google_ad_height = 60;

--></script>

<script type="text/javascript"

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>


<!-- End of GoogleAds Code -->


<tr><td height="401" colspan="2" align="left" valign="top"><img src="images/sider.JPG" width="100%" height="4"></span></p>


<!-- Start of StatCounter Code -->

<script type="text/javascript">

var sc_project=2874796; 

var sc_invisible=0; 

var sc_partition=29; 

var sc_security="9903d388"; 

</script>


<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c30.statcounter.com/2874796/0/9903d388/0/" alt="web stats" /></a></div></noscript>


<!-- End of StatCounter Code -->


</body>


<!-- Begin Google stats code for asr -->

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">

</script>

<script type="text/javascript">

_uacct = "UA-2665783-1";

urchinTracker();

</script>

<!-- End Google stats code for asr -->

</div >

.
Posted Image

Programming Languages: Java, VB6, VB2005 (.NET2)
Web Languages: HTML, CSS, JS

Website: http://abdn.ac.uk/~u41am6

Opportunity is missed by most people because it is dressed in overalls and looks like work.

#2
domestic

domestic

    Learning Programmer

  • Members
  • PipPipPip
  • 44 posts
never mind. had missed "</a>". stupid mistake. But Dreamwaever doesnt check html code in php. and i dont know of any software that does. grrrrr
.
Posted Image

Programming Languages: Java, VB6, VB2005 (.NET2)
Web Languages: HTML, CSS, JS

Website: http://abdn.ac.uk/~u41am6

Opportunity is missed by most people because it is dressed in overalls and looks like work.

#3
ReekenX

ReekenX

    Programmer

  • Members
  • PipPipPipPip
  • 134 posts
When you having problems like these, check you page with validator: World Wide Web Consortium
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx

#4
Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guests
The checkers will often turn up more HTML errors than you care to know about. What I mean is they don't work well and half the things they say are not true like

Missing </td>

When you can clearly see it in your HTML.

#5
ReekenX

ReekenX

    Programmer

  • Members
  • PipPipPipPip
  • 134 posts
In all my projects I am testing my web pages with validators, so every errors I can fix fast. Try it too ;)
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx