<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LAMP with ·dotmanila &#187; HTML</title>
	<atom:link href="http://dotmanila.com/blog/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://dotmanila.com/blog</link>
	<description>Linux, Apache, PHP, MySQL Musings</description>
	<lastBuildDate>Wed, 01 Feb 2012 23:32:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Book Review: HTML5 &#8211; Up and Running</title>
		<link>http://dotmanila.com/blog/2011/02/book-review-html5-up-and-running/</link>
		<comments>http://dotmanila.com/blog/2011/02/book-review-html5-up-and-running/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 03:25:22 +0000</pubDate>
		<dc:creator>jervin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://dotmanila.com/blog/?p=168</guid>
		<description><![CDATA[Catch up over the weekend on HTML5. HTML5 &#8211; Up and Running&#8217;s simple and short rundown on what&#8217;s new and valuable with the newest version of HTML is an essential for any frontend developer&#8217;s shelf. This book, with a little more compression can be a cheatsheet or even a pocket guide! Since working as an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://oreilly.com/catalog/9780596806026/"><img class="alignleft" title="HTML5 - UP and Running Cover Page" src="http://covers.oreilly.com/images/9780596806026/cat.gif" alt="HTML5 - UP and Running Cover Page" width="180" height="236" /></a>Catch up over the weekend on HTML5. HTML5 &#8211; Up and Running&#8217;s simple and short rundown on what&#8217;s new and valuable with the newest version of HTML is an essential for any frontend developer&#8217;s shelf. This book, with a little more compression can be a cheatsheet or even a pocket guide!</p>
<p>Since working as an &#8220;apprentice&#8221; to the top MySQL DBAs around, I seem to have lost a bit of touch over what&#8217;s new at the front lines of web applications i.e. CSS3, Javascript Framework and HTML5. Personally, I found an excitement factor reading the book chapter through chapter, with everything new on HTML5 and the possibilities it can deliver with your future projects, it just keeps pulling you into reading.</p>
<p>Another nice thing about this book is that you can just grab whichever chapter you need i.e. if you simply want to test and learn for employing videos on your pages quickly, go ahead and jump to Chapter 5! It also puts together a number of examples that puts together other technologies to effectively use the new features. This one now belongs to my overhead shelf for easy access anytime <img src='http://dotmanila.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dotmanila.com/blog/2011/02/book-review-html5-up-and-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Validate_StringEquals</title>
		<link>http://dotmanila.com/blog/2010/01/zend_validate_stringequals/</link>
		<comments>http://dotmanila.com/blog/2010/01/zend_validate_stringequals/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 14:54:23 +0000</pubDate>
		<dc:creator>jervin</dc:creator>
				<category><![CDATA[Application Security]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Zend_Input_Filter]]></category>
		<category><![CDATA[Zend_Validate]]></category>

		<guid isPermaLink="false">http://dotmanila.com/blog/?p=121</guid>
		<description><![CDATA[If you ever wonder where that &#8216;StringEquals&#8217; validator rule taken as example from the Zend_Filter_Input documentation page results in an error like below, well read again. It was clearly stated as &#8216;hypothetical&#8217;. Plugin by name &#8216;StringEquals&#8217; was not found in the registry; used paths: Zend_Validate_: Zend/Validate/ Given such validator would be useful on a number [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever wonder where that &#8216;StringEquals&#8217; validator rule taken as example from the Zend_Filter_Input documentation page results in an error like below, well read again. It was clearly stated as &#8216;hypothetical&#8217;.</p>
<blockquote>
<h3>Plugin by name &#8216;StringEquals&#8217; was not found in the registry; used paths: Zend_Validate_: Zend/Validate/</h3>
</blockquote>
<p>Given such validator would be useful on a number of situations i.e. confirming passwords, emails, etc. I present to you my own version of the class.</p>
<pre class="brush: php;ruler: true;">
&lt;?php
"%field1% and %field2% are not equal.",
        self::MISSING	=&gt; "One or both strings are missing."
    );

    /**
     * @var array
     */
    protected $_messageVariables = array(
        'field1' =&gt; '_field1',
        'field2' =&gt; '_field2'
    );

    protected $_case = false;
    protected $_field1 = null;
    protected $_field2 = null;

    /**
     * Sets validator options
     *
     * @param  boolean $case
     * @return void
     */
    public function __construct($case = false)
    {
        $this-&gt;_case = $case;
    }

    /**
     * Defined by Zend_Validate_Interface
     *
     * Returns true if and only if the the 2 strings are equal
     *
     * @param  array $value
     * @return boolean
     */
    public function isValid($value)
    {
    	if(!is_array($value) OR sizeof($value) &lt; 2) {
			$this-&gt;_error(self::MISSING);
    	}

    	$this-&gt;_field1 = array_shift($value);
    	$this-&gt;_field2 = array_shift($value);

        if($this-&gt;_case === true) $function = 'strcmp';
        else $function = 'strcasecmp';

        if(0 !== $function($this-&gt;_field1,$this-&gt;_field2)) $this-&gt;_error(self::NOT_EQUAL);

        if (count($this-&gt;_messages)) {
            return false;
        } else {
            return true;
        }
    }
}
?&gt;</pre>
<p>Here is a sample test case. Validate password and confirm password elements represented by &#8216;password&#8217; and &#8216;cpassword&#8217; element names respectively.</p>
<pre class="brush: php">$filters = array('password' =&gt; 'StringTrim', 'cpassword' =&gt; 'StringTrim');
$validators = array(
    'Password' =&gt; array(
        'presence' =&gt; 'required',
        array('StringLength',5,15),
        'fields' =&gt; 'password',
        'messages' =&gt; "Passwords must be between 5 and 15 characters in length."),
    'Confirm password' =&gt; array(
        array('StringEquals'),
        'fields' =&gt; array('password','cpassword'),
        'messages' =&gt; array(
            0 =&gt; array(
                Zend_Validate_StringEquals::NOT_EQUAL =&gt; "Passwords does not match.",
                Zend_Validate_StringEquals::MISSING =&gt; "Both password fields must be filled."))));

$inputdata = new Zend_Filter_Input($filter,$validators,$_POST,$options);</pre>
]]></content:encoded>
			<wfw:commentRss>http://dotmanila.com/blog/2010/01/zend_validate_stringequals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fetch Smarty Templates From MySQL Database</title>
		<link>http://dotmanila.com/blog/2009/03/fetch-smarty-templates-from-mysql-database/</link>
		<comments>http://dotmanila.com/blog/2009/03/fetch-smarty-templates-from-mysql-database/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 11:40:57 +0000</pubDate>
		<dc:creator>jervin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php smarty]]></category>
		<category><![CDATA[smarty mysql]]></category>
		<category><![CDATA[templates database]]></category>

		<guid isPermaLink="false">http://dotmanila.com/blog/?p=48</guid>
		<description><![CDATA[I was recently working on a mailing application. With the nature of the bulk mailing routine, it was designed to store templates made by its users and email designers. Since most of them have been exposed to Smarty templating before we decided to base our email template parsing to Smarty.]]></description>
			<content:encoded><![CDATA[<p>I was recently working on a mailing application. With the nature of the bulk mailing routine, it was designed to store templates made by its users and email designers. Since most of them have been exposed to Smarty templating before we decided to base our email template parsing to Smarty.</p>
<p>Smarty does not come with the ability to parse templates from database natively, but it is easy to extend it to do just that.</p>
<p>DISCLAIMER: This is a quick and dirty hack I provided with my colleagues. Improvement required!</p>
<p>This approach should work on both PHP 4 and PHP 5, since Smarty.class.php is written on PHP 4.</p>
<p>What we will need to do is extend Smarty.class.php on a new class and override function <code>_fetch_resource_info</code> and replace the <code>if</code> clause demonstrated below to use our code that actually fetches database stored templates.</p>
<pre>
class Smarty
{
    function _fetch_resource_info(&amp;$params) {
        ....
        if ($this->_parse_resource_name($_params)) {
            .....
        }
        ....
    }
}
</pre>
<p>Our resulting class would look something like:</p>
<pre>
require_once 'Smarty.class.php';

class Smarty_Db extends Smarty
{
    function _fetch_resource_info(&amp;$params) {
        ....
        $_resource_type = $_params['resource_type'];
        $_resource_name = $_params['resource_name'];

	$db = new Template_Db;
	if ($params['get_source']) {
            $params['source_content'] = $db->fetchTemplate($myTemplateId);
        }
	$params['resource_timestamp'] = now();
        $_return = true;
        ....
    }
}
</pre>
<p>So you would then use your Smarty extended class like:</p>
<pre>
$smarty = new Smarty_Db;
$smarty->compile_dir = '/path/to/my/compile/dir';

$compiledTemplateFromDb = $smarty->fetch($myTemplateId);
</pre>
<p>That is all there is to it actually. I haven&#8217;t went through all the Smarty pre and post processing, but this should suffice the requirements for now.</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotmanila.com/blog/2009/03/fetch-smarty-templates-from-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS Gradient Text Effect</title>
		<link>http://dotmanila.com/blog/2009/01/css-gradient-text-effect/</link>
		<comments>http://dotmanila.com/blog/2009/01/css-gradient-text-effect/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 11:30:42 +0000</pubDate>
		<dc:creator>jervin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[css effects]]></category>
		<category><![CDATA[text gradients]]></category>

		<guid isPermaLink="false">http://dotmanila.com/blog/?p=34</guid>
		<description><![CDATA[This is a very useful and cool CSS design approach, saves time and effort and still SEO friendly. Hit the link for more.]]></description>
			<content:encoded><![CDATA[<p>This is a very useful and cool CSS design approach, saves time and effort and still SEO friendly. Hit the link for more.</p>
<blockquote><p>Do you want to create fancy headings without rendering each heading with Photoshop? Here is a simple CSS trick to show you how to create gradient text effect with a PNG image (pure CSS, no Javascript or Flash). All you need is an empty <span> tag in the heading and apply the background image overlay using the CSS position:absolute property. This trick has been tested on most browsers: Firefox, Safari, Opera, and even Internet Explorer 6. Continue to read this article to find out how.<br />
</span></p></blockquote>
<p><a href="http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/" target="_blank">http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dotmanila.com/blog/2009/01/css-gradient-text-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

