/    Sign up×
Community /Pin to ProfileBookmark

Using php query to fetch data from other web pages

Hi guys,

At the mo I am using php function to fetch different data stored all in one page so that I only have to have the code for my header and navigation once and then I can display the different pages all from this page – if this makes sense.

I have since been told that I should be storing the other pages content in different files and fetching them from their… cos my page/file will be too big otherwise…

Does any1 have any idea how to do this please?

I would really appreciate any help/examples.

This is the way I am doing it currently

<?php
function getCSS($x) {
if ($x == $_GET[“Section”]) {
echo “activeButton”;
} else {
echo “button”;
}
}
?>

<td align=”middle”><a class=”<?php getCSS(“”)?>”href=”index.php”>Home</a></td>
<td align=”middle” width=”1″><span class=”style22″>&nbsp;|&nbsp; </span></td>
<td align=”middle”><a class=”<?php getCSS(“Registration”)?>” href=”index.php?Section=Registration”>Free Registration</a></td>

<?php
switch ($_GET[“Section”]) {
case “Registration”:

Thanks very much

Brain.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@Bahamut-XeroFeb 24.2006 — <?php include ($_SERVER["DOCUMENT_ROOT"]."/includes/head.php"); ?>

works for me. make a separate file called head.php and put your head in that. just paste that line into every page. never have to change it again ?
×

Success!

Help @The_Hick_Man spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...