..
Moderator: General Moderators
Re: PHP and Meta Data
Have a function in meta.php which generates the meta data, and pass it an argument of the page you want the data for maybe?
Re: PHP and Meta Data
Code: Select all
function generate_meta($page)
{
switch($page)
{
case 'index':
return 'meta ddata for the index page';
break;
case 'another page':
return 'meta data for another page';
break;
}
}- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: PHP and Meta Data
Sounds like your meta data belongs in the database, which can easily be queried for. Loading a potentially large file of meta data when we will only be using specific elements seems like a waste of cycles.
Re: PHP and Meta Data
Good point.
Re: PHP and Meta Data
You'd pass it as an argument to the function.
But the same concept can apply to the database. Have a column called `Page` or something, and select the details for whatever page you're on.
But the same concept can apply to the database. Have a column called `Page` or something, and select the details for whatever page you're on.
Re: PHP and Meta Data
Code: Select all
$page = 'index';
generate_meta($page);Re: PHP and Meta Data
You could do this:
Code: Select all
$page = reset(explode('.', basename(__FILE__)));