Insert a link in the slideshow

this is a code:

    <?php $conteggio = 1;?>
 <body >
        <ul class="slideshowBlueBox">
        <?php foreach ($page->children()->find('slide')->slides()->toStructure() as $sfondo):?>
            <li style="list-style: none;">
<a href="<?=  $sfondo->slide_url() ?>">
<span>Image <?php echo  $conteggio;?>
</span>
</a>
</li>
            <?php $conteggio++; endforeach;?>
        </ul>

but <?= $sfondo->slide_url() ?> this link comes out https://www.granshoppingmongolfiera.it/home/slide/gsm_website-2-aper19.jpg<br%20/>https://www.voglioilbraccialetto.com 4

Without knowing what you have stored in your content file or what is in your blueprint, it will be difficult to find out where things are going wrong.

Also, is this still the same issue as in your other post? Then we should probably continue there?

my blueprint is this:

end this is home.php

But what is actually stored in your content file?

this is my web site if it can help you https://www.granshoppingmongolfiera.it/

I can’t find the code you posted above in the template?

And no, the website doesn’t help, I’d like to know what is stored in your content file, at least an example.

There is no link here:

<?php $conteggio = 1;?>
 <body >



        <ul class="slideshowBlueBox">

        <?php foreach ($page->children()->find('slide')->slides()->toStructure() as $sfondo):?>
            <li style="list-style: none;">

<span>Image <?php echo $conteggio;?></span> </li>





            <?php $conteggio++; endforeach;?>
        </ul>

it was an old file

this is the updated code https://drive.google.com/file/d/17GI2ik7eCBpPyJL4933kKnvOZioZIJRa/view?usp=sharing

This line

<?php foreach ($page->children()->find('slide')->slides()->url_slide()->toStructure() as $sfondo):?>

doesn’t make sense

it should be like what you posted above

<?php foreach ($page->children()->find('slide')->slides()->toStructure() as $sfondo):?>

On a side note: I’d move the styles to their own file and use inline styles for the background images. The variables can probably be best dealt with using CSS variables, I think.

OK but it gives me the same error

I am repeating myself: What is in the content files?

I did not understand the question

I mean the text file of the slide page, so that we can see what is actually stored in the content.

you can’t see it from the site or I have that by removing this code `

<?php snippet($page->intendedTemplate().'_mobile') ?>
` it doesn't give me the wrongness anymore

Oh, ok, fine.

but I can’t remove this code because it’s the mobile template

I lost my crystal ball, so I can’t see your code in that snippet :wink:

1 Like

this is the snippet code:

I don’t know how that affects the home.php, but this code

<img
		src="<?php echo $page->children()->find('slide')->url().'/'.$sfondo;?>"
		alt=""
		title="HTML.it"
		onclick="parent.location=''"
	/>

can’t possibly work, because $sfondo is the complete structure item, not the image.