par
Smartie'S » 03 mars 2009, 15:30
Bonjour,
Je pètes les plombs, je suis depuis ce matin sur un problème que je n'arrive pas à resoudre et vous verrez que ce n'est pas faute d'avoir essayé ..
Le problème : des variables qui refusent d'être prises en compte lors de l'affichage de ma page web.
Détails :
/index.php
/includes/function.php
/includes/vars.php
index.php
<?php
include('includes/function.php');
include('includes/vars.php');
// [..] mes conditions, tests sur les variables etc.
type_checker();
url_parser($page[$_GET['page']]);
echo $start;
include($url);
?>
function.php
<?php
function url_parser($value)
{
$headers = explode('#', $value);
global $url, $abstract, $keywords, $title;
$url = $headers[0];
$abstract = $headers[1];
$keywords = $headers[2];
$title = $headers[3];
}
function type_checker()
{
global $contentType, $docType;
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
{
$contentType = 'application/xhtml+xml';
$docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
}
else {
$contentType = 'text/html';
$docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
}
}
?>
vars.php
<?php
$dir = '/test/'; // mon url quand en ligne, mon repertoire wamp qd hors ligne
// exemple de chaîne qui est passée dans ma fonction url_parser()
//
$value = 'pages/contact.php#Contactez-moi via le formulaire ou grâce aux autres méthodes proposées sur cette page.#mail, e-mail, contact, joindre, courriel, @, twitter#Contact | monsite.com'
//
$start = $docType . '
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="' . $contentType . '; charset=utf-8" />
<meta http-equiv="Content-Language" content="fr-be" />
<meta name="robots" content="index, follow" />
<meta name="verify-v1" content="+ymzc2kKtQy8SItoakg3HH/+mYzJGUoyvG+cf8mmNy4=" />
<meta name="description" content="' . $abstract . '" />
<meta name="keywords" content="' . $keywords . '" />
<title>' . $title . '</title>
<link rel="stylesheet" type="text/css" href="' . $dir . 'design/css/global.css" media="all" />
<!--[if lte IE 6]><style type="text/css">div#content { margin: 4.55em 0 0 0; }</style><![endif]-->
</head>
<body>
<div id="header"><h1><span>' . $abstract . '</span></h1></div>
<div id="global">
<ul id="left-column"><li><img src="' . $dir . 'images/picture.png" width="199px" height="266px" alt="Photo" title="Crédit photo : Héctor Serrano" /></li><li><a href="' . $dir . 'contact/" class="contact">Contact</a></li><li><a href="http://twitter.com" class="twitter">Follow me on Twitter</a></li><li><a href="#" class="labo">Laboratoire</a></li></ul>
<div id="right-column">
<ul id="nav">
<li><a href="' . $dir . '">Accueil <span class="separator">: </span><span class="description">généralités</span></a></li>
<li><a href="' . $dir . 'portfolio/">Réalisations <span class="separator">: </span><span class="description">quelques créations</span></a></li>
<li><a href="' . $dir . 'publications/">Publications <span class="separator">: </span><span class="description">ressources</span></a></li>
</ul>
<div id="content">';
?>
Auriez-vous une idée de solution ?
Un grand merci d'avance.
Bonjour,
Je pètes les plombs, je suis depuis ce matin sur un problème que je n'arrive pas à resoudre et vous verrez que ce n'est pas faute d'avoir essayé ..
[b]Le problème :[/b] des variables qui refusent d'être prises en compte lors de l'affichage de ma page web.
[b]Détails :[/b]
[php]/index.php
/includes/function.php
/includes/vars.php[/php]
[i]index.php[/i]
[php]<?php
include('includes/function.php');
include('includes/vars.php');
// [..] mes conditions, tests sur les variables etc.
type_checker();
url_parser($page[$_GET['page']]);
echo $start;
include($url);
?>[/php]
[i]function.php[/i]
[php]<?php
function url_parser($value)
{
$headers = explode('#', $value);
global $url, $abstract, $keywords, $title;
$url = $headers[0];
$abstract = $headers[1];
$keywords = $headers[2];
$title = $headers[3];
}
function type_checker()
{
global $contentType, $docType;
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
{
$contentType = 'application/xhtml+xml';
$docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
}
else {
$contentType = 'text/html';
$docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
}
}
?>[/php]
[i]vars.php[/i]
[php]<?php
$dir = '/test/'; // mon url quand en ligne, mon repertoire wamp qd hors ligne
// exemple de chaîne qui est passée dans ma fonction url_parser()
//
$value = 'pages/contact.php#Contactez-moi via le formulaire ou grâce aux autres méthodes proposées sur cette page.#mail, e-mail, contact, joindre, courriel, @, twitter#Contact | monsite.com'
//
$start = $docType . '
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="' . $contentType . '; charset=utf-8" />
<meta http-equiv="Content-Language" content="fr-be" />
<meta name="robots" content="index, follow" />
<meta name="verify-v1" content="+ymzc2kKtQy8SItoakg3HH/+mYzJGUoyvG+cf8mmNy4=" />
<meta name="description" content="' . $abstract . '" />
<meta name="keywords" content="' . $keywords . '" />
<title>' . $title . '</title>
<link rel="stylesheet" type="text/css" href="' . $dir . 'design/css/global.css" media="all" />
<!--[if lte IE 6]><style type="text/css">div#content { margin: 4.55em 0 0 0; }</style><![endif]-->
</head>
<body>
<div id="header"><h1><span>' . $abstract . '</span></h1></div>
<div id="global">
<ul id="left-column"><li><img src="' . $dir . 'images/picture.png" width="199px" height="266px" alt="Photo" title="Crédit photo : Héctor Serrano" /></li><li><a href="' . $dir . 'contact/" class="contact">Contact</a></li><li><a href="http://twitter.com" class="twitter">Follow me on Twitter</a></li><li><a href="#" class="labo">Laboratoire</a></li></ul>
<div id="right-column">
<ul id="nav">
<li><a href="' . $dir . '">Accueil <span class="separator">: </span><span class="description">généralités</span></a></li>
<li><a href="' . $dir . 'portfolio/">Réalisations <span class="separator">: </span><span class="description">quelques créations</span></a></li>
<li><a href="' . $dir . 'publications/">Publications <span class="separator">: </span><span class="description">ressources</span></a></li>
</ul>
<div id="content">';
?>[/php]
Auriez-vous une idée de solution ?
Un grand merci d'avance.