Re: Help with CSS Rollover Links

2009-06-12 Thread DbZeroOne

Ok, good advice from both of you. This is what my code looks like now:

link('',array('controller'=>'blog','action' =>
'index'),array('ID' => 'homebtn','alt' => 'Home'));
echo $html->link('',array('controller'=>'blog','action' =>
'bestof'),array('ID' => 'best',  ,'alt' => 'Best Postings'));
?>

This should be one button to the right of the other.There will be 5
total in a horizontal menu.

The problem now is that only one button will work at a time (link and
rollover). Either one will work when they're alone, but together, only
the first one will work (whichever one is first). I've tried
everything I can think of, but either nothing changes or the whole
page blanks out.

Thank you for your input.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Help with CSS Rollover Links

2009-06-11 Thread DbZeroOne

First, I'm just starting to learn Cake, so my question may seem a
little idiotic...



I'm trying to add some rollover buttons to a page in a CakePHP
application that I inherited from a previous developer.

I prefer to do CSS rollovers vs. Javascript. So far the layout is
working very well, but I'm having a tough time figuring out how to
make a graphical button with a link using the CSS rollover method (1
background image that changes position on hover). If this were HTML,
my code would look like this:



That CSS class 'homebtn' would handle the image, size, float, hover,
etc. and the HREF part tells it where to link to. Easy enough.

In Cake, my code looks like this...

link($html->style("homebtn"), array('controller'=>'blog',
'action' => 'index'));
?>

My best guess is that the code above is saying: "make an HTML link of
the CSS class 'homebtn' and process clicks through the controller
named 'blog'.

The problem is that the image/rollover part doesn't work and I can't
find any info on how to make it work. The CSS class doesn't seem to be
getting pulled in. All that shows is a text link that says 'homebtn',
which does link correctly, by the way.

I'm using CakePHP 1.2 and the class 'homebtn' is in my style.css
stylesheet which is properly linked into the head of default.ctp.

Suggestions?

--~--~-~--~~~---~--~~
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: Clueless Newbie question

2009-06-02 Thread DbZeroOne

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:



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:


/**
 * 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);
}


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  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  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
> > 

Clueless Newbie question

2009-06-01 Thread DbZeroOne

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 is http://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 , 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 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
-~--~~~~--~~--~--~---