custom <header> lines

Permalink
I have a custom header.php with the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<link href="<?php echo $this->getThemePath();?>/main.css" rel="stylesheet" type="text/css">
<?php Loader::element('header_required'); ?>
</head>
<body>
<?php 
   include_once(dirname(__FILE__) . "/../Constants/ThemeConstants.php");
?>[/core]
But now I have a custom site "publications.php" which lists lots of publications. I can also add, edit and view those publications over concrete5. Now the problem: I want for each of those publications specific data to appear in the header, in the meta information. I know that there is a custom attribute for meta title and stuff, but I need some things to be set up automatically...
This is the starting of my publications.php:
[code]<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));


Now I want for example $pobj->cID to appear in a <meta type="whatever" content="$pobj->cID"> header-line. How could I do this? Is there any c5 function that I just need to call and tell him what to aditionally put into the header?

 
Lintu replied on at Permalink Reply
Oh hell that syntax crapped up. But I seem to cannot edit it?

I try again:


I have a custom header.php with the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<link href="<?php echo $this->getThemePath();?>/main.css" rel="stylesheet" type="text/css">
<?php Loader::element('header_required'); ?>
</head>
<body>
<?php 
   include_once(dirname(__FILE__) . "/../Constants/ThemeConstants.php");
?>


But now I have a custom site "publications.php" which lists lots of publications. I can also add, edit and view those publications over concrete5. Now the problem: I want for each of those publications specific data to appear in the header, in the meta information. I know that there is a custom attribute for meta title and stuff, but I need some things to be set up automatically...
This is the starting of my publications.php:

<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));
$this->inc('elements/header.php');
require("elements/pagetype_header.php");
include_once(dirname(__FILE__)."/Constants/SSE2WEBConstants.php");
$con = new SSE2WEBConstants;
?>


Now I want for example $pobj->cID to appear in a <meta type="whatever" content="$pobj->cID"> header-line. How could I do this? Is there any c5 function that I just need to call and tell him what to aditionally put into the header?
Hypocrite replied on at Permalink Reply
Hypocrite
I think the easiest way would be to add a new custom attribute to the page type you are using. Then add the custom information for all the pages which use that page type and fill in the value. You could also add the custom attribute as default for that page type so that you don't have add it to new pages each time you create a new page.

Then call the attribute value by its handle.

So something like this:
<meta name="custom_meta" content="<?php $c->getAttribute('custom_meta'); ?>" />
Lintu replied on at Permalink Reply
But I need data from other blocks in the meta-Tag, and I don't really wanna have the same data twice for each publication, once in the block and once for a meta attribute.

Can I also add block data to a custom meta tag?
Hypocrite replied on at Permalink Reply
Hypocrite
You could add the block to your global scrapbook and then display it in your template like this:
<?php
$block = Block::getByName('Meta title'); 
$block->display();
?>
jordanlev replied on at Permalink Reply
jordanlev