• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
meta() function not documented.

#1
[eluser]DooBie[/eluser]
Hi all, I have seen in html_helper that there is a new feature that is not documented, but it is very useful, at least for me, the function is this:
Code:
// ------------------------------------------------------------------------

/**
* Generates meta tags from an array of key/values
*
* @access    public
* @param    array
* @return    string
*/
if ( ! function_exists('meta'))
{
    function meta($meta = array(), $newline = "\n")
    {
        $str = '';
        foreach ($meta as $key => $val)
        {
            $str .= '<meta http-equiv="'.$key.'" content="'.$val.'" />'.$newline;
        }

        return $str;
    }
}
Why not come out in the documentation?

Thanks, and sorry my poor english

#2
[eluser]Derek Allard[/eluser]
Looks like an oversight, apologies. You want to take a first stab at writing the docs for it and I'll get it into the manual?

#3
[eluser]DooBie[/eluser]
Are you asking me to write the documentation of this function?
I am sorry, but, I do not understand correctly what you say to me, if it is it, I will be delighted(enchanted), of it, his(her,your) use is very simple.

Code:
DOC:
meta()

Lets you create HEAD <meta /> tags. The first parameter contains an associative array for meta name to meta value. The second, are optional, and is for a newline caracter, by default is "\n". Example:
$metas = array(
  'author' => 'My name',
  'description' => 'My cool website :)',
  'title' => 'Welcome to my site');
echo meta($metas);
/*
gives
<meta http-equiv="author" content="My name" />
<meta http-equiv="description" content="My cool website :)" />
<meta http-equiv="title" content="Welcome to my site" />
*/

There is an optional second parameter that is a string for the last caracters in the meta, by default, this parameter are a newline caracter ("\n"). Example:

$metas = array(
  'author' => 'My name',
  'description' => 'My cool website :)',
  'title' => 'Welcome to my site');
echo meta($metas, '');
/*
gives
<meta http-equiv="author" content="My name" /><meta http-equiv="description" content="My cool website :)" /><meta http-equiv="title" content="Welcome to my site" />
*/

I repeat, sorry for my english

#4
[eluser]Derek Allard[/eluser]
Thanks for your help. Because of your post we ended up re-visiting this helper. Its quite different now (you can still do what you need to though), and its been documented.

#5
[eluser]DooBie[/eluser]
Thanks Derek Allard!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.