John,
The version, according to version.txt is 1.2.0.6311 beta.
I'm trying to place this app into an empty table cell, so it matches
the look and feel of the rest of the site. The code for the images is
standard HTML, with the assumption that the images folder is in
webroot. For example:
<img src="img/myimage.png">
Martin,
Adding HTML to app/webroot/index.php is exactly what I did. When I had
no success I started digging a bit online and found that I should be
using app/views/layout/default.ctp. I removed all the code from
index.php and started adding it to default.ctp, but the same problem
persists.
I started reading about Helpers, and found cake/libs/view/helpers/
html.php which I *think* is the right place to look. Inside there I
found this:
<pre>
/**
* Creates a formatted IMG element.
*
* @param string $path Path to the image file, relative to the app/
webroot/img/ directory.
* @param array $htmlAttributes Array of HTML attributes.
* @return string
*/
function image($path, $options = array()) {
if (is_array($path)) {
$path = Router::url($path);
} elseif ($path{0} === '/') {
$path = $this->webroot($path);
} elseif (strpos($path, '://') !== false) {
$path = $path;
} else {
if (Configure::read('Asset.timestamp') == true &&
Configure::read()
> 0) {
$path .= '?' . @filemtime(str_replace('/', DS,
WWW_ROOT .
IMAGES_URL . $path));
}
$path = $this->webroot(IMAGES_URL . $path);
}
if (!isset($options['alt'])) {
$options['alt'] = '';
}
$url = false;
if (!empty($options['url'])) {
$url = $options['url'];
unset($options['url']);
}
$image = sprintf($this->tags['image'], $path,
$this->_parseAttributes
($options, null, '', ' '));
if ($url) {
return $this->output(sprintf($this->tags['link'],
$this->url($url),
null, $image));
}
return $this->output($image);
}
</pre>
I'm a bit confused here... not sure if this is even the correct file/
code. Am I on the right track?
Thanks for the help guys! I truly appreciate it!
On Jun 2, 12:25 am, Martin Westin <[email protected]> wrote:
> Hi,
> Mod rewrite is used so that Cake can "fake" folders on the server (as
> the browser sees it).
>
> example.com/ - The browser things you are in the root folder on the
> server.
> example.com/pages/home - The browser things you are in the pages
> folder on the server.
> example.com/pages/home/ - The browser things you are in the pages/home
> folder on the server.
>
> Sounds like you have added html to app/webroot/index.php to style your
> application. This is not a very good idea. For a start that html has
> no idea which "fake folder" Cake is showing the browser. As so anytime
> you navigate around the app all references to css, javascript and
> images will "change" relative to the perceived location.
>
> The above explanation of mod rewrite is ass backwards as a general way
> to understand the feature. I was trying to illustrate how static html
> in a browser sees relative and absolute paths. Nothing more.
>
> Check out the folder app/views/layouts/. Here you can add any wrapping
> html you want in a much more Cake-friendly way. From there you can
> also use Cake's helpers to link to images and other assets in a way
> that will not break no matter what.
>
> /Martin
>
> On Jun 2, 1:11 am, DbZeroOne <[email protected]> wrote:
>
> > Hello all,
>
> > I've found myself thrust into a project that the previous developer
> > made using CakePHP. I'm a little familiar with PHP, but it's taken me
> > a couple days to figure out how Cake works.
>
> > Anyway, I have what seems to be a very simple question, but it's
> > driving me crazy! My question is..."Where do the images go?!"
>
> > The directory on my server
> > ishttp://localhost/mydomain.com/testing/app/webroot
> > which is common, I think.
>
> > My images folder is in webroot as is my index.php.
>
> > I've wrapped the code in index.php with some design elements which
> > looks fine as long as I'm on index.php page. Once I click a link, the
> > PHP part generates itself a URL that doesn't really exist, but it
> > works fine. The problem is that the images in the wrapper no longer
> > work. EVERYTHING works fine, but the images ONLY work on webroot/
> > index.php.
>
> > I've tried putting them in every folder I could think of, I've looked
> > deeply into the files to see if there was some config somewhere and
> > I've searched all over the 'net to find an answer and nothing seems to
> > address this exact situation.
>
> > By the way, mod_rewrite is on.
>
> > Is there some way I can say "Always find images <here>, regardless of
> > what URL is generated"?
>
> > I apologize for my ignorance.... one day I'll be an expert! :) Thank
> > you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---