If you use CakePHP as PHP framework then you'll see some different types of files: CTP. And you'll need to see them as a php file in your PHP editor, Eclipse. For this you'll do this:
Preference>General>Content Types>Php then add *.ctp
And then you need to restart Eclipse IDE for have an effect.
Aug 14, 2015
CakePHP
Last 2 weeks I tried to put ZF2 to my project www.mateonline.net. It was endless pain to configure Zend Framework 2 for me as a beginner with this. ZF2 as syntax is very nice. But something got wrong with server configuration.
So, then I said I will try Symfony 2. But, I quit immediately. I though it will be easier, but it is no so nice as ZF2.
And, then I pass to CakePHP. Which I like. Except the fact that it has no PDO. I don't like how is linked to MySQL DB but I can use to it.
So, then I said I will try Symfony 2. But, I quit immediately. I though it will be easier, but it is no so nice as ZF2.
And, then I pass to CakePHP. Which I like. Except the fact that it has no PDO. I don't like how is linked to MySQL DB but I can use to it.
Aug 3, 2015
PHP namespace
When you use namespace on PHP scripts you have to use require(), require_once(), include() or include_once() . It doesn't work without one of these like you can see on this example:
http://php.net/manual/en/language.namespaces.rationale.php
A better example is here:
http://www.sitepoint.com/php-53-namespaces-basics/
php namespaces are case-insensitive:
file1.php:
namespace foo;
function bar()
{
echo 'from bar';
}?>
file2.php:
fOo\bar() // output: from bar
?>
This example is here:file1.php:
namespace foo;
function bar()
{
echo 'from bar';
}?>
file2.php:
fOo\bar() // output: from bar
?>
http://php.net/manual/en/language.namespaces.rationale.php
A better example is here:
http://www.sitepoint.com/php-53-namespaces-basics/
Jul 23, 2015
Javascript redirect for mobile devices
The best method to redirect for mobile that I found is following:
<script type="text/javascript">
if (screen.width < 1081) {
var ref = document.referrer;
var urls = new Array("http://www.mymainsite.com","http://m.mymobilesite.com");
var n = ref.match(urls[0]);
var m = ref.match(urls[1]);
if ((m!==null) || (n!==null)) {
stop;
}
else if (ref=='') {
var r = confirm("Small Display is Detected.\nClick \"OK\" for MOBILE SITE.");
if (r==true) {
window.location = "http://m.mymobilesite.com";
}
else {
stop ;
}
}
else
{
window.location = "http://m.mymobilesite.com";
}
}
</script>
Angular JS
Last days I was struggling with implementation of Angular JS on one my websites: www.pensiunealajura.ro/mobil/
The big issue with this was to list HTML code without listing HTML tags like < or >. For instance, I wanted to have
This is a bold text.
not
This is a <b>bold text</b>.
So, I tried to have this with the module ngSanitize and $sanitize and $sce with $sce.trustAsHtml.
But all of these were not good. And i dug more. And I found out that the best way to write formatted HTML code into a web page using Angular JS is using directive ngBindHtml as is explained here:
https://docs.angularjs.org/api/ng/directive/ngBindHtml
Now, everything is ok with my page.
:)
The big issue with this was to list HTML code without listing HTML tags like < or >. For instance, I wanted to have
This is a bold text.
not
This is a <b>bold text</b>.
So, I tried to have this with the module ngSanitize and $sanitize and $sce with $sce.trustAsHtml.
But all of these were not good. And i dug more. And I found out that the best way to write formatted HTML code into a web page using Angular JS is using directive ngBindHtml as is explained here:
https://docs.angularjs.org/api/ng/directive/ngBindHtml
Now, everything is ok with my page.
:)
Labels:
Angular JS,
AngularJS,
coding,
html,
javascript,
library
Subscribe to:
Posts (Atom)
