Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Including header file using HTML

HTML header

  • Please log in to reply
43 replies to this topic

#37 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 07 July 2008 - 11:26 AM

Although you could use frames, then adjust the page's href. Or use AJAX, which is sort of JS.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#38 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 07 July 2008 - 04:46 PM

I guess you would have to use frames to do this without server code which is kind of pointless.

Just curious, if somebody comes across your header.php which your including, what do you usually do? like you probably don't want them to see header.php? would you redirect them to the home page if they came across header.php?

just curious?
  • 0

#39 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 09 July 2008 - 04:29 AM

Yeah, I haven't thought about that! Is header.php indexed by Google?
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#40 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 09 July 2008 - 05:00 AM

I imagine it would be, because it is on the web server so the search engines would probably find the file eventually.

Might not be that good if the user comes across header.php.


<?php
if ((basename("header.php") == "header.php")) {
$i = 1;
header("Location: index.php");
} else {
echo "Hi!";
}
?>


maybe something like this to fix it? not tested though. :D
  • 0

#41 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 09 July 2008 - 07:25 AM

Nope. The SE will not find it, unless you come on CC and post a link to it to ask help or something like that..

Because the SE only crawls the outputted HTML
  • 0

#42 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 09 July 2008 - 07:32 AM

But you still wouldn't want a user to accidentely stumble on to header.php or some other included file and that code i posted below doesn't actually work. :\ it gets you in an endless loop of redirecting to index.php
  • 0

#43 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 09 July 2008 - 07:43 AM

What would the $i = 1 bit do?
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#44 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 09 July 2008 - 07:46 AM

That was in there as an attempt to stop the redirect but it didn't work and I forgot to take that out. :\

I have no idea how to stop the endless loop.

Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.



<?php
if ((basename("header.php") == "header.php")) {
header("Location: index.php");
} else {
echo "Hi!";
}
?>

  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download