A hero image only for main for main url

hi
how can i put a hero image in my application to only be displayed in my main url and does not be displayed in other urls?

Sure, why not? :wink:
If you want to know how to do that, than show what you have now.

1 Like

i have my two controllers and i want when user inters main url which is localhost/karbag/
an image be displayed in all around the page but when user go to another url like localhost/karbag/posts/add, then the image does not be displayed again.
i’m using default.ctp, when i place it in default.ctp it is displayed in every url and when i place the div in index.ctp that is for my main rout, it’s not working at all

If it displays via default.ctp it should work the same way in index.ctp. Share here your index.ctp with the image.

thank you for your time
it’s not working in index.ctp because in default.ctp i have things to be displayed above the div for content which comes from index.ctp
in default.ctp i display content from index.ctp using the following code.


<?= $this->Flash->render() ?> <?php echo $this->fetch('content'); ?>
if i place a div for hero image in index.ctp, then it comes after the some above divs i want to be on all the width and height 100%. i'm asking if i can write a code to check if it is in main url show the div for hero image, otherwise do not.

problem solved

<?php $host = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if($host == 'localhost/karbag/'): ?>

کار یا کارمند احتیاج دارید؟

می خواهید بخرید یا بفروشید؟

<?php endif; ?>

$this->request has variables to do that too.

Just FYI