davekelly
08-12-2004, 09:59 AM
HI, first off I really don't know anything about ASP or .NET, I mainly specialise with PHP, however I'm building a site on a server that onyl supports ASP and ASP.NET. What I want to do is simulate the same thing I usually do with PHP, whereby instead of having include lines in each page for the site to display headers, footers, and side menus etc, I have one single file, in the past cases this was just an index.php with the following code:
<?php
if (!empty($_GET['id'])) {
$id = $_GET['id'];
$inklood = 'content/' . $id . '.php';
} else {
$id = 'home';
$inklood = 'content/main.php';
}
if (!file_exists ($inklood)) {
$bad_path = 'index.php?id=' . $id;
@include ('errors/404.html');
} else {
@include ('header.php');
@include ('right.php');
@include ('left.php');
@include ($inklood);
@include ('footer.php');
}
?>
So basically you'd always have that file display the header, side bars, then the specific page contents using a query line like index.php?id=yourpage followed by the footer after that. I much prefer this method rather than having the same includes in every page, is it possible to replicate this method in ASP or ASP.NET? Any help would be great.
(Btw incase you're wondering why in that list the right bar is included before the left bar it's because this is done in XHTML using negative margins and floats so I have the code for all menus before the content so my skip nav link jumps all menu links as im building a fully accessible site.)
<?php
if (!empty($_GET['id'])) {
$id = $_GET['id'];
$inklood = 'content/' . $id . '.php';
} else {
$id = 'home';
$inklood = 'content/main.php';
}
if (!file_exists ($inklood)) {
$bad_path = 'index.php?id=' . $id;
@include ('errors/404.html');
} else {
@include ('header.php');
@include ('right.php');
@include ('left.php');
@include ($inklood);
@include ('footer.php');
}
?>
So basically you'd always have that file display the header, side bars, then the specific page contents using a query line like index.php?id=yourpage followed by the footer after that. I much prefer this method rather than having the same includes in every page, is it possible to replicate this method in ASP or ASP.NET? Any help would be great.
(Btw incase you're wondering why in that list the right bar is included before the left bar it's because this is done in XHTML using negative margins and floats so I have the code for all menus before the content so my skip nav link jumps all menu links as im building a fully accessible site.)