add something to page metadata with UDT
add something to page metadata with UDT
Hallo,
is it possible to add something to the page metadata (HEAD section of the HTML output) within a plugin (or UDT)? In particular I want add some "..." or "..." blocks to the HEAD section.
Regards,
Carsten
is it possible to add something to the page metadata (HEAD section of the HTML output) within a plugin (or UDT)? In particular I want add some "..." or "..." blocks to the HEAD section.
Regards,
Carsten
Re: add something to page metadata with UDT
Yes, but UDT is php code, why don't use GBC (plain html)?Wiedmann wrote: is it possible to add something to the page metadata (HEAD section of the HTML output) within a plugin (or UDT)? In particular I want add some "..." or "..." blocks to the HEAD section.
Alby
Re: add something to page metadata with UDT
I think my problem was not clear enougt...
I'm working on a tag (CMSForge), which other CMSms users can install in their plugin directory. The tag is called with "{pluginname param1 param2 ...}" in the user template.
Now in smarty_cms_function_pluginname() I have "a lot" of PHP code which produce and return HTML. Part of this code is "JS code". But I don't want have this javascript in the returned HTML code, instead I want have this javascript in den section of the page.
Maybe in the future, a "style declarations" will also be part of the returned HTML code. But "" is not allowed in "". Thus this part must be in "".
(BTW: The FormBuilder module have the same bug, and puts a "" block in the output ( section) with the default installation/settings)
I'm working on a tag (CMSForge), which other CMSms users can install in their plugin directory. The tag is called with "{pluginname param1 param2 ...}" in the user template.
Now in smarty_cms_function_pluginname() I have "a lot" of PHP code which produce and return HTML. Part of this code is "JS code". But I don't want have this javascript in the returned HTML code, instead I want have this javascript in den section of the page.
Maybe in the future, a "style declarations" will also be part of the returned HTML code. But "" is not allowed in "". Thus this part must be in "".
(BTW: The FormBuilder module have the same bug, and puts a "" block in the output ( section) with the default installation/settings)
Re: add something to page metadata with UDT
Add your UDT tag in head section of your template (same of {title},{metadata},.. tags):Wiedmann wrote: Now in smarty_cms_function_pluginname() I have "a lot" of PHP code which produce and return HTML. Part of this code is "JS code". But I don't want have this javascript in the returned HTML code, instead I want have this javascript in den section of the page.
{pluginname param1 param2 ...}
Alby
Re: add something to page metadata with UDT
No, the script and style is only a part of the output...
a little more(hyphotetic) code:
function.mytag.php
As you can see, the result of this tag is not valid html. Especially the style must go the section. Ad the javascript should also go there. The rest is normal page content.
And no, I don't want use inlinestyle... Just installing this plugin and using it with "{mytag field='foo'}" should be enough for the user.
(BTW: Just look to the output of a standard FormBuilder form, and you can see the problem.)
Or a simiar example to explain:
With this code I can see the metadata of the current page. How can I edit this metadata?
a little more(hyphotetic) code:
function.mytag.php
Code: Select all
<?php
function smarty_cms_function_mytag($params, &$smarty)
{
// other PHP code
$result = '
<style type="text/css">
/* <![CDATA[ */
/* some style declaratiions */
.form {background-image:url(background.gif);}
.field {background-color:#ffa;}
.button {background-color:#aaa;}
/* ]]> */
</style>
<__script__ type="text/javascript">
function sendForm () {
/* <![CDATA[ */
//some javascript code
return true;
/* ]]> */
}
<!-- some HTML markup -->
<form name="testform" action="" onsubmit="return sendForm();" class="form">
<input name="field1" type="text" class="field" value='.$params['field'].'/>
<input type="submit" class="button" />
</form>';
return $result;
}
?>
And no, I don't want use inlinestyle... Just installing this plugin and using it with "{mytag field='foo'}" should be enough for the user.
(BTW: Just look to the output of a standard FormBuilder form, and you can see the problem.)
Or a simiar example to explain:
Code: Select all
<?php
function smarty_cms_function_mytag($params, &$smarty)
{
$pageinfo =& $GLOBALS['gCms']->variables['pageinfo'];
echo $pageinfo->content_metadata;
}
?>
Re: add something to page metadata with UDT
Each page has a metadata field. Can it be placed there?
Nullig
Nullig
Re: add something to page metadata with UDT
No, have you ever seen this?:Can it be placed there?
Code: Select all
<__html>
<head>
<form>...</form>
</head>
</__body><__body>
</__html>
The result, only with using the tag in a page template, must be something like:
Code: Select all
<__html>
<head>
<style>...</style>
<__script__>...</__script>
</head>
</__body>
<form>...</form>
<__body>
</__html>
Exact, and that's the question for the developers (you?):Each page has a metadata field.
Is there a CMS or Smarty function to change this page metadata within a plugin or UDT?
(Have you now test the FormBuilder module and looked at the output?)
Re: add something to page metadata with UDT
No, I'm not one of the developers, but it would seem that there should be a way of "trapping" and manipulating that field data from the content somewhere between pulling it from the db and rendering it.
Nullig
Nullig
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: add something to page metadata with UDT
actually, no, there is no way in the modules to effect the metadata.
At least not in 1.2.3
that's why for things like the {embed} tag you have to put one tag in the header, and another tag into the page content somewhere.
At least not in 1.2.3
that's why for things like the {embed} tag you have to put one tag in the header, and another tag into the page content somewhere.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: add something to page metadata with UDT
The easiest way would be to provide info in the help section of the plugin for the user to add the appropriate javascript to the head portion of their template, if they want to have valid XHTML. That way they could create a specific template for the pages that use the tag.
Nullig
Nullig
Re: add something to page metadata with UDT
See this post by calguy...
http://forum.cmsmadesimple.org/index.ph ... #msg102120
There might be a way to do this.
Nullig
PS @ Wiedmann - I've sent you some PMs, but not heard back.
http://forum.cmsmadesimple.org/index.ph ... #msg102120
There might be a way to do this.
Nullig
PS @ Wiedmann - I've sent you some PMs, but not heard back.
Last edited by Nullig on Wed Apr 09, 2008 12:17 am, edited 1 time in total.