Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
Well, that is strange. The only slight warning bell in the back of my head is $menu. What is $menu? A helper? If you include and instantiate that object yourself then possibly, maybe, that throws the html helper off. I have only ever used helpers inside the layout, a view or an element On Jun 10, 5:13 pm, Jasper wrote: > CSS input in layout\default.ctp: > echo $html->css( 'global' ); > CSS output: > > > In layout\default.ctp: > echo $menu->show(); > In menu.php: > $output .= $html->image("pijl_rechts.gif", array("alt" => "Move > Right",'url' => array('controller' => 'links', 'action' => > 'makeChild', $val['Link']['id']) )); > return $output; > Image URL output: > Page 1 > > Notice the href having /jtcms, and the img having img in front. > > On 10 jun, 09:27, Martin Westin wrote: > > > > > Problems with linking to images css or javascript are often the result > > of problems with the rewriting of urls. That is why I wanted you to > > check the .htaccess files were there. > > > Also the fact that you had "app" as a component of your path is odd > > and might have thrown Cake a bit. > > > But I now noticed a tiny detail in your original post. You wrote that > > you got a path like ".\" (dot backslash). That does not look right > > either. Paths always use forward slashes and, in my installations, > > they are all output as absolute paths (starting from the website > > root). > > > The strange part is that all the things that I know of that can cause > > this kind of problem would also show themselves for your css and > > javascript. > > > On Jun 9, 8:12 pm, Jasper wrote: > > > > I don't have the .htaccess file in my cake folder, but it isn't in the > > > cake zip archive either. > > > > But excuse me, I don't understand what the .htaccess has to do with my > > > problem in the first post. Cake writes a relative URL, that works ok > > > if you put the helper in the action.ctp, but I have it in the > > > default.ctp layout file. Now image urls are relative to "index.php" so > > > to speak, and the browser is confused with urls like /controller/ > > > action/parameter, because the image doesn't exist in /controller/ > > > action/img/image.gif. Maybe this has to do with the default.ctp being > > > rendered before it is passed to the action, so it doens't know how to > > > construct the url for the action? > > > > On 9 jun, 16:20, Martin Westin wrote: > > > > > if htdocs is the root folder your urls should look something like > > > > > localhost/jtcms/controller/action > > > > > You might also have lost one of the ".htaccess" files that help Apache > > > > give Cake the correct path info. There should be one (usually > > > > invisible) in each of the folders jtcms, app, webroot. Especially Mac > > > > users (like me) can loose these since they are invisible and do not > > > > always come along in a normal copy operation. > > > > > On Jun 9, 10:08 am, Jasper wrote: > > > > > > htdocs/jtcms/app > > > > > htdocs/jtcms/cake > > > > > > But if I configure cake correct, it does output the full image path? I > > > > > couldn't believe I was the only one with this problem... > > > > > > On 8 jun, 16:11, Martin Westin wrote: > > > > > > > Not a bug. You either have a configuration problem or just missed > > > > > > how > > > > > > your install does its redirection. You should never have to use > > > > > > "app" > > > > > > in your urls. > > > > > > > try using urls like localhost/controller/action > > > > > > > What is your layout? > > > > > > localhost points to a folder containing cake, app, vendors, ... ? > > > > > > > On Jun 8, 9:27 am, Jasper wrote: > > > > > > > > Hi, > > > > > > > > The Html->image helper in the layoutfile outputs an img tag with > > > > > > > the > > > > > > > path ".\img\image.gif". The browser can only find it when I am > > > > > > > only > > > > > > > one level deep, i.e. "http://localhost/app/controller";. When I > > > > > > > add a > > > > > > > trailing slash, the images are broken. And when I visit an action, > > > > > > > like "http://localhost/app/controller/action";, it's also broken. > > > > > > > The > > > > > > > browser looks for "http://localhost/app/controllers/img/image.gif"; > > > > > > > > code-tag: > > > > > > > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > > > > > > > array('controller' => 'links', 'action' => 'moveDown', > > > > > > > $val['Link'] > > > > > > > ['id'],1) )) > > > > > > > > Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - > > > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit > > > > > > oorspronkelijk bericht niet weergeven - > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit > > > > oorspronkelijk bericht niet weergeven - > > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@goo
Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
CSS input in layout\default.ctp: echo $html->css( 'global' ); CSS output: In layout\default.ctp: echo $menu->show(); In menu.php: $output .= $html->image("pijl_rechts.gif", array("alt" => "Move Right",'url' => array('controller' => 'links', 'action' => 'makeChild', $val['Link']['id']) )); return $output; Image URL output: Page 1 Notice the href having /jtcms, and the img having img in front. On 10 jun, 09:27, Martin Westin wrote: > Problems with linking to images css or javascript are often the result > of problems with the rewriting of urls. That is why I wanted you to > check the .htaccess files were there. > > Also the fact that you had "app" as a component of your path is odd > and might have thrown Cake a bit. > > But I now noticed a tiny detail in your original post. You wrote that > you got a path like ".\" (dot backslash). That does not look right > either. Paths always use forward slashes and, in my installations, > they are all output as absolute paths (starting from the website > root). > > The strange part is that all the things that I know of that can cause > this kind of problem would also show themselves for your css and > javascript. > > On Jun 9, 8:12 pm, Jasper wrote: > > > > > I don't have the .htaccess file in my cake folder, but it isn't in the > > cake zip archive either. > > > But excuse me, I don't understand what the .htaccess has to do with my > > problem in the first post. Cake writes a relative URL, that works ok > > if you put the helper in the action.ctp, but I have it in the > > default.ctp layout file. Now image urls are relative to "index.php" so > > to speak, and the browser is confused with urls like /controller/ > > action/parameter, because the image doesn't exist in /controller/ > > action/img/image.gif. Maybe this has to do with the default.ctp being > > rendered before it is passed to the action, so it doens't know how to > > construct the url for the action? > > > On 9 jun, 16:20, Martin Westin wrote: > > > > if htdocs is the root folder your urls should look something like > > > > localhost/jtcms/controller/action > > > > You might also have lost one of the ".htaccess" files that help Apache > > > give Cake the correct path info. There should be one (usually > > > invisible) in each of the folders jtcms, app, webroot. Especially Mac > > > users (like me) can loose these since they are invisible and do not > > > always come along in a normal copy operation. > > > > On Jun 9, 10:08 am, Jasper wrote: > > > > > htdocs/jtcms/app > > > > htdocs/jtcms/cake > > > > > But if I configure cake correct, it does output the full image path? I > > > > couldn't believe I was the only one with this problem... > > > > > On 8 jun, 16:11, Martin Westin wrote: > > > > > > Not a bug. You either have a configuration problem or just missed how > > > > > your install does its redirection. You should never have to use "app" > > > > > in your urls. > > > > > > try using urls like localhost/controller/action > > > > > > What is your layout? > > > > > localhost points to a folder containing cake, app, vendors, ... ? > > > > > > On Jun 8, 9:27 am, Jasper wrote: > > > > > > > Hi, > > > > > > > The Html->image helper in the layoutfile outputs an img tag with the > > > > > > path ".\img\image.gif". The browser can only find it when I am only > > > > > > one level deep, i.e. "http://localhost/app/controller";. When I add a > > > > > > trailing slash, the images are broken. And when I visit an action, > > > > > > like "http://localhost/app/controller/action";, it's also broken. The > > > > > > browser looks for "http://localhost/app/controllers/img/image.gif"; > > > > > > > code-tag: > > > > > > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > > > > > > array('controller' => 'links', 'action' => 'moveDown', $val['Link'] > > > > > > ['id'],1) )) > > > > > > > Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - > > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit > > > > > oorspronkelijk bericht niet weergeven - > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk > > > bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
Problems with linking to images css or javascript are often the result of problems with the rewriting of urls. That is why I wanted you to check the .htaccess files were there. Also the fact that you had "app" as a component of your path is odd and might have thrown Cake a bit. But I now noticed a tiny detail in your original post. You wrote that you got a path like ".\" (dot backslash). That does not look right either. Paths always use forward slashes and, in my installations, they are all output as absolute paths (starting from the website root). The strange part is that all the things that I know of that can cause this kind of problem would also show themselves for your css and javascript. On Jun 9, 8:12 pm, Jasper wrote: > I don't have the .htaccess file in my cake folder, but it isn't in the > cake zip archive either. > > But excuse me, I don't understand what the .htaccess has to do with my > problem in the first post. Cake writes a relative URL, that works ok > if you put the helper in the action.ctp, but I have it in the > default.ctp layout file. Now image urls are relative to "index.php" so > to speak, and the browser is confused with urls like /controller/ > action/parameter, because the image doesn't exist in /controller/ > action/img/image.gif. Maybe this has to do with the default.ctp being > rendered before it is passed to the action, so it doens't know how to > construct the url for the action? > > On 9 jun, 16:20, Martin Westin wrote: > > > > > if htdocs is the root folder your urls should look something like > > > localhost/jtcms/controller/action > > > You might also have lost one of the ".htaccess" files that help Apache > > give Cake the correct path info. There should be one (usually > > invisible) in each of the folders jtcms, app, webroot. Especially Mac > > users (like me) can loose these since they are invisible and do not > > always come along in a normal copy operation. > > > On Jun 9, 10:08 am, Jasper wrote: > > > > htdocs/jtcms/app > > > htdocs/jtcms/cake > > > > But if I configure cake correct, it does output the full image path? I > > > couldn't believe I was the only one with this problem... > > > > On 8 jun, 16:11, Martin Westin wrote: > > > > > Not a bug. You either have a configuration problem or just missed how > > > > your install does its redirection. You should never have to use "app" > > > > in your urls. > > > > > try using urls like localhost/controller/action > > > > > What is your layout? > > > > localhost points to a folder containing cake, app, vendors, ... ? > > > > > On Jun 8, 9:27 am, Jasper wrote: > > > > > > Hi, > > > > > > The Html->image helper in the layoutfile outputs an img tag with the > > > > > path ".\img\image.gif". The browser can only find it when I am only > > > > > one level deep, i.e. "http://localhost/app/controller";. When I add a > > > > > trailing slash, the images are broken. And when I visit an action, > > > > > like "http://localhost/app/controller/action";, it's also broken. The > > > > > browser looks for "http://localhost/app/controllers/img/image.gif"; > > > > > > code-tag: > > > > > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > > > > > array('controller' => 'links', 'action' => 'moveDown', $val['Link'] > > > > > ['id'],1) )) > > > > > > Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit > > > > oorspronkelijk bericht niet weergeven - > > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
I don't have the .htaccess file in my cake folder, but it isn't in the cake zip archive either. But excuse me, I don't understand what the .htaccess has to do with my problem in the first post. Cake writes a relative URL, that works ok if you put the helper in the action.ctp, but I have it in the default.ctp layout file. Now image urls are relative to "index.php" so to speak, and the browser is confused with urls like /controller/ action/parameter, because the image doesn't exist in /controller/ action/img/image.gif. Maybe this has to do with the default.ctp being rendered before it is passed to the action, so it doens't know how to construct the url for the action? On 9 jun, 16:20, Martin Westin wrote: > if htdocs is the root folder your urls should look something like > > localhost/jtcms/controller/action > > You might also have lost one of the ".htaccess" files that help Apache > give Cake the correct path info. There should be one (usually > invisible) in each of the folders jtcms, app, webroot. Especially Mac > users (like me) can loose these since they are invisible and do not > always come along in a normal copy operation. > > On Jun 9, 10:08 am, Jasper wrote: > > > > > htdocs/jtcms/app > > htdocs/jtcms/cake > > > But if I configure cake correct, it does output the full image path? I > > couldn't believe I was the only one with this problem... > > > On 8 jun, 16:11, Martin Westin wrote: > > > > Not a bug. You either have a configuration problem or just missed how > > > your install does its redirection. You should never have to use "app" > > > in your urls. > > > > try using urls like localhost/controller/action > > > > What is your layout? > > > localhost points to a folder containing cake, app, vendors, ... ? > > > > On Jun 8, 9:27 am, Jasper wrote: > > > > > Hi, > > > > > The Html->image helper in the layoutfile outputs an img tag with the > > > > path ".\img\image.gif". The browser can only find it when I am only > > > > one level deep, i.e. "http://localhost/app/controller";. When I add a > > > > trailing slash, the images are broken. And when I visit an action, > > > > like "http://localhost/app/controller/action";, it's also broken. The > > > > browser looks for "http://localhost/app/controllers/img/image.gif"; > > > > > code-tag: > > > > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > > > > array('controller' => 'links', 'action' => 'moveDown', $val['Link'] > > > > ['id'],1) )) > > > > > Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk > > > bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
if htdocs is the root folder your urls should look something like localhost/jtcms/controller/action You might also have lost one of the ".htaccess" files that help Apache give Cake the correct path info. There should be one (usually invisible) in each of the folders jtcms, app, webroot. Especially Mac users (like me) can loose these since they are invisible and do not always come along in a normal copy operation. On Jun 9, 10:08 am, Jasper wrote: > htdocs/jtcms/app > htdocs/jtcms/cake > > But if I configure cake correct, it does output the full image path? I > couldn't believe I was the only one with this problem... > > On 8 jun, 16:11, Martin Westin wrote: > > > > > Not a bug. You either have a configuration problem or just missed how > > your install does its redirection. You should never have to use "app" > > in your urls. > > > try using urls like localhost/controller/action > > > What is your layout? > > localhost points to a folder containing cake, app, vendors, ... ? > > > On Jun 8, 9:27 am, Jasper wrote: > > > > Hi, > > > > The Html->image helper in the layoutfile outputs an img tag with the > > > path ".\img\image.gif". The browser can only find it when I am only > > > one level deep, i.e. "http://localhost/app/controller";. When I add a > > > trailing slash, the images are broken. And when I visit an action, > > > like "http://localhost/app/controller/action";, it's also broken. The > > > browser looks for "http://localhost/app/controllers/img/image.gif"; > > > > code-tag: > > > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > > > array('controller' => 'links', 'action' => 'moveDown', $val['Link'] > > > ['id'],1) )) > > > > Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - > > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
htdocs/jtcms/app htdocs/jtcms/cake But if I configure cake correct, it does output the full image path? I couldn't believe I was the only one with this problem... On 8 jun, 16:11, Martin Westin wrote: > Not a bug. You either have a configuration problem or just missed how > your install does its redirection. You should never have to use "app" > in your urls. > > try using urls like localhost/controller/action > > What is your layout? > localhost points to a folder containing cake, app, vendors, ... ? > > On Jun 8, 9:27 am, Jasper wrote: > > > > > Hi, > > > The Html->image helper in the layoutfile outputs an img tag with the > > path ".\img\image.gif". The browser can only find it when I am only > > one level deep, i.e. "http://localhost/app/controller";. When I add a > > trailing slash, the images are broken. And when I visit an action, > > like "http://localhost/app/controller/action";, it's also broken. The > > browser looks for "http://localhost/app/controllers/img/image.gif"; > > > code-tag: > > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > > array('controller' => 'links', 'action' => 'moveDown', $val['Link'] > > ['id'],1) )) > > > Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Html->image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
Not a bug. You either have a configuration problem or just missed how your install does its redirection. You should never have to use "app" in your urls. try using urls like localhost/controller/action What is your layout? localhost points to a folder containing cake, app, vendors, ... ? On Jun 8, 9:27 am, Jasper wrote: > Hi, > > The Html->image helper in the layoutfile outputs an img tag with the > path ".\img\image.gif". The browser can only find it when I am only > one level deep, i.e. "http://localhost/app/controller";. When I add a > trailing slash, the images are broken. And when I visit an action, > like "http://localhost/app/controller/action";, it's also broken. The > browser looks for "http://localhost/app/controllers/img/image.gif"; > > code-tag: > $html->image("pijl_onder.gif", array("alt" => "Move Down",'url' => > array('controller' => 'links', 'action' => 'moveDown', $val['Link'] > ['id'],1) )) > > Is this a bug? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---