How to add meta from database to view pages?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mehmetbkm
User
Posts: 21

How to add meta from database to view pages?

Post by mehmetbkm »

I need to add a value from the database to every view page. I wrote the code below, but wherever I put it, it didn't work.

<?php 
if (CurrentPageID() == "view") {
    echo '<meta name="dc.title" content="' . CurrentPage()->kitap_adi->CurrentValue . '">';
}
?>

arbei
User
Posts: 9787

Post by arbei »

If you want to add meta tag, you should use Page_Head server event.


mehmetbkm
User
Posts: 21

Post by mehmetbkm »

It's very strange, I add the following value to the "Server Eventes -> Global -> All Pages -> Page_Head" section. When I look at the page source, I only see it in the standard index page, I cannot see it on the "view" pages.

The value I added:

<meta name="author" content="Foo Bar">


arbei
User
Posts: 9787

Post by arbei »

Page_Head is fired in the Layout page, which means all pages with the <head> tag. Did you have any condition before outputting the meta tag? Post your complete code for discussion.


mehmetbkm
User
Posts: 21

Post by mehmetbkm »

You are completely right, it's my fault, it's working.


Post Reply