21282 Posts in 5730 Topics by 2601 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1766 Views |
-
Extend Meta Tab

17 January 2009 at 2:11am
How can I extend the meta tag tab to include additional information. We have about 50 additional meta tags (Dublin Core / eGMS) that we need to include.
-
Re: Extend Meta Tab

17 January 2009 at 2:53am
Sorry pinkdigital I cant help you with your problem (new to SS myself).
I was wondering what goverment site you are developing/re-developing and how SS is working out for you?
-
Re: Extend Meta Tab

17 January 2009 at 3:28am
You can find some info here: http://doc.silverstripe.org/doku.php?id=tutorial:2-extending-a-basic-site
Here is an (untested) example. Create a page: tutorial/code/YourPage.php
<?php
/**
* Defines the YourPage page type
*/
class YourPage extends Page {static $db = array(
'Meta1' => 'Text',
'Meta2' => 'Text'
);static $has_one = array(
);
}class YourPage_Controller extends Page_Controller {
function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Metadata', new TextField('Meta1'));
$fields->addFieldToTab('Root.Content.Metadata', new TextField('Meta2'));
return $fields;}
}?>
-
Re: Extend Meta Tab

17 January 2009 at 3:40am Last edited: 17 January 2009 4:12am
Hi PinkDigital
I think your best option would be to add a ComplexTableField to add metadata objects to your page (like those in tutorial 4).So first you need to define your meta data object like this:
mysite/code/MetaTag.phpThen in your Page.php you would have something like this:
mysite/code/Page.phpthen finally in the <head> of your Page template you would do something like this:
themes/templates/Page.ss<% control MetaTags %>
<meta name="$Name" <% if http_equiv %> http-equiv="$http_equiv" <% end_if %> content="$Content" >
<% end_control %> -
Re: Extend Meta Tab

17 January 2009 at 11:10am
Thanks guys very helpful...
Taffy, the only sticking point we have found was the DC / eGMS requirements - everything else SS handles with ease. This will be our 5th SS site (others are basic CMS sites) and we love it.
-
Re: Extend Meta Tab

31 October 2009 at 6:19pm Last edited: 31 October 2009 6:33pm
Hi aram,
Can you expand on your comments please? I did what you mentioned, but get errors. 2.3.3What I really want to do is get a custom field just before my closing </body> tag so that I can insert specific to the page, a script from google website optimizer. Currently I have the editor to except scripts and forms, but for some reason the footer/body script they have - some of it gets stripped out. The Custom Meta Tag works great for inserting code into the head of each page.
I was able to add a field to the Metadata tab at the bottom where I wanted it using this code...
public static $db = array(
'CustomBodyTags' => 'HTMLText'
);$fields->addFieldToTab('Root.Content.Metadata', new TextField('CustomBodyTags'));
Added $CustomBodyTags to the bottom of my template.
Also, I would like the Custom Body Tags field on the meta tab to have 5 rows just like the others.
Any ideas on how to pull this off?
This is the google script... First script stays, second script gets stripped from the editor - the <script> tags stay.
Again, I would prefer that I can just enter the code into the meta field.<!-- Google Website Optimizer Conversion Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<script type="text/javascript">
try {
var gwoTracker=_gat._getTracker("UA-11120272-2");
gwoTracker._trackPageview("/0581277756/goal");
}catch(err){}</script>
<!-- End of Google Website Optimizer Conversion Script --> -
Re: Extend Meta Tab

31 October 2009 at 6:31pm
Now it is working. The script shows up fine in the source code!
So my next questions would be if this is the right way to do this???
And, how can I make the field have 5 rows - memofield?
-
Re: Extend Meta Tab

31 October 2009 at 7:52pm
I got this figured out now too...
$fields->addFieldToTab("Root.Content.Metadata", new TextareaField("CustomBodyTags", "Custom Body Tags"));
Added the TextareaField and the , "Custom Body Tags" to get my spaces.
| 1766 Views | ||
|
Page:
1
|
Go to Top |




