Reputation: 123
I am new in CakePHP, trying to make a site in it. In the site, I have some elements which come several times(header, footer, bottom parts). In the "bottom" part, I have some images. Problem is, those images are showed on only "Home" page, not the other pages (about, contact, etc.) The "bottom" part is : p
<div class="bottom">
.
.
.
<div class="col col14">
<h4>Photo Gallery</h4>
<ul class="footer_gallery">
<li><a href="img/image_l.jpg"><img src="img/image_1.jpg" alt="Image 01" /></a> </li>
<li><a href="img/image_2.jpg"><img src="img/image_2.jpg" alt="Image 02" /></a></li>
<li><a href="img/image_3.jpg"><img src="img/image_3.jpg" alt="Image 03" /></a></li>
<li><a href="img/image_4.jpg"><img src="img/image_4.jpg" alt="Image 04" /></a></li>
<li><a href="img/image_5.jpg"><img src="img/image_5.jpg" alt="Image 05" /></a></li>
<li><a href="img/image_6.jpg"><img src="img/image_6.jpg" alt="Image 06" /></a></li>
<li><a href="img/image_7.jpg"><img src="img/image_7.jpg" alt="Image 07" /></a></li>
<li><a href="img/image_8.jpg"><img src="img/image_8.jpg" alt="Im'age 08" /></a></li>
<li><a href="img/image_9.jpg"><img src="img/image_9.jpg" alt="Image 09" /></a></li>
</ul>
<div class="cleaner h20"></div>
<a href="portfolio.html" class="more">more</a>
</div>
.
.
.
</div>p
Upvotes: 0
Views: 57
Reputation: 3807
I dont think this is a CakePHP related problem, but when using Cakephp, the best approach is to use Cake's HTML Helper as such:
<?php echo $this->Html->image("image_1.jpg", array(
"alt" => "Image 1",
'url' => array('controller' => 'examplecontroller', 'action' => 'view', 6)
)); ?>
However, if you still want to stick with what you have here, then you need to make sure your links to the image are represented as
<li><a href="/img/image_l.jpg"><img src="/img/image_1.jpg" alt="Image 01" /></a> </li>
not <li><a href="img/image_l.jpg"><img src="img/image_1.jpg" alt="Image 01" /></a> </li>
This way you are guaranteed to reach your image, regardless of where you are calling it from within your app.
Upvotes: 1