Permalink
Browse files

* HtcHelper created

  - Htc->add($, $) function added
  • Loading branch information...
1 parent 34fbb2e commit eabeda7c42a69a71ad56bc2bb37e26220682da07 @barbir committed Oct 18, 2010
Showing with 57 additions and 0 deletions.
  1. +16 −0 htc_app_controller.php
  2. +16 −0 htc_app_model.php
  3. +25 −0 views/helpers/htc.php
View
@@ -0,0 +1,16 @@
+<?php
+/*
+ * This file is part of CakePHP Htc Plugin.
+ *
+ * CakePHP Htc Plugin
+ * Copyright (c) 2010, Miljenko Barbir (http://miljenkobarbir.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+*/
+class HtcAppController extends AppController
+{
+
+}
+
+?>
View
@@ -0,0 +1,16 @@
+<?php
+/*
+ * This file is part of CakePHP Htc Plugin.
+ *
+ * CakePHP Htc Plugin
+ * Copyright (c) 2010, Miljenko Barbir (http://miljenkobarbir.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+*/
+class HtcAppModel extends AppModel
+{
+
+}
+
+?>
View
@@ -0,0 +1,25 @@
+<?php
+/*
+ * This file is part of CakePHP Htc Plugin.
+ *
+ * CakePHP Htc Plugin
+ * Copyright (c) 2010, Miljenko Barbir (http://miljenkobarbir.com)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+*/
+class HtcHelper extends AppHelper
+{
+ /*
+ * Returns a script which contains the style block which includes the provided htc file.
+ * For now, it expect the htc files to be located in the css folder in the webroot.
+ */
+ function add($htmlElement, $htcName)
+ {
+ // calculate the path to the htc file
+ $url = $this->webroot(CSS_URL . $htcName);
+ return "<style type=\"text/css\">$htmlElement { behavior: url(\"$url\") }</style>\n";
+ }
+}
+
+?>

3 comments on commit eabeda7

Thank you for this plugin, I'm new in cakephp, and still don't know how to use plugin with my scripts, would give me a example?

Owner

barbir replied Aug 22, 2011

I usually add it to my layout file (app\views\layouts\default.ctp), I add the behavior like this (within the head HTML tag):

<!--[if IE]>
    <?php echo $this->Htc->add('body', 'csshover3.htc'); ?>
<![endif]-->

Ok, I got it! thanx.

Please sign in to comment.