May 26 2008

CSS margin auto on IE 7 (with CakePHP?)

Classified in: CSS, CakePHP, HTML, Internet explorerpaomic at 2:11 pm

I had a problem with the margin CSS property on a website with cake. Actually, I used a CSS template for Wordpress, copying the code to my website. The code seemed identical, the CSS too, but while on Firefox everything was ok, using IE 7 the page was left oriented (while using Firefox, or accessing a blog with that theme with Iinternet Explorer 7, it was centered). After a long debugging, i discovered that CakePHP was configured with debug level 1, which outputted the compilation time at the beginning of the page, in a comment. This seemed to upset IE, because when I set the debug level to 1, the comment disappeared and IE 7 displayed the page properly too.

Tags:

May 04 2008

CakePHP 404 error

Classified in: CakePHPpaomic at 4:32 pm

Sometimes I experience a 404 error while opening a view of a newly added controller. I found out that this issue is due to cache problems, so removing the cache (usually found inĀ  tmp/cache) can solve this problem. Also delete the persistent directory inside the cache dir.

Tags:

Jan 27 2008

CakePHP and EXTJS tree

Classified in: CakePHPpaomic at 12:11 pm

Hi all!

I had to insert a tree in order to edit the structure of a menu. I found out that extjs tree are great! It lets you add a tree with dynamic content and move node from the root to leafs. So I tried integrating it, it’s really easy.

I added a js function to the tree javascript (from the reorder example in the extjs package)

function getTreeContents(tree) {
return getNodeContents(tree.root,true);
}

function getNodeContents(node) {
var s = ”;
if(node.childNodes.length > 0)
{
for(var i=0; i<node.childNodes.length; i++) {
s+= node.id+’-'+node.childNodes[i].id +’|';
s += getNodeContents( node.childNodes[i],false);
}
}
return s;
}

This returns a list of parentid-childid which, everytime the tree is changed, I add to a hidden textbox. Then I get the value of this textbox in the controller code, parse it and update all the nodes according to passed values.

That’s it!

Tags:

Oct 31 2007

CakePHP and paths

Classified in: CakePHP, Programmingpaomic at 3:31 pm

I had a problem related to CakePHP and url. I found some articles, such as this or this, but I still can’t find a solution. I try to access a file in the app/webroot directory, but using www.mysite.com/myfile.jpg or www.mysite.com/app/webroot/myfile.jpg don’t work…

Any help or ideas?

Edit: I made a few mistakes, so I was using the wrong path, with the correct path it works fine.

PS: the images are placed in the main webroot directory, but they are accessed using website.com/app/image.ext

Tags: