S
S
sadboy2017-08-30 12:50:31
PHP
sadboy, 2017-08-30 12:50:31

How to generate id?

Good afternoon. The information block element is displayed on the site, when you click on the element, a modal window opens, which contains the announcement of this element.
here is the element code

<div class="sites-block-element-container " style="width: 180px;">
                            <a  href="#openModal">
                                <div class="sites-block-element hov-activ" style="width:180px; height: 104px;" >
                                <span class="wrap">

            <img
                                src="<?=$arItem["PREVIEW_PICTURE"]["SRC"]?>"
                                width="120px"
                                alt="<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>"
                        />

                      </span>
</div>
</div>

here is the modal code
<div id="openModal" class="modalDialog">
                    <div style="text-align: center;">
                        <a href="#close" title="Закрыть" class="close">X</a>
                        <h2 ><?=$arItem["NAME"]?></h2>
                        <img
                                src="<?=$arItem["PREVIEW_PICTURE"]["SRC"]?>"
                                width="<?=$arItem["PREVIEW_PICTURE"]["WIDTH"]?>"
                                height="<?=$arItem["PREVIEW_PICTURE"]["HEIGHT"]?>"
                                alt="<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>"
                        />
                        <p style="text-align: left;"><?=$arItem["PREVIEW_TEXT"]?></p>
                    </div>
                </div>

Now to the problem, now when I click on different elements, the announcement of the element that is displayed first is shown. How can I make it so that each element has its own announcement.
PS as I understand it, you need to do something with the id, but I don’t rummage in php and don’t know how to implement the solution

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
one_day, 2017-08-30
@sadboy

<a  href="#openModal"> -> <a  href="#<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>">
<div id="openModal" class="modalDialog"> -> <div id="<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>" class="modalDialog">

M
Maxim Timofeev, 2017-08-30
@webinar

but i'm not good at php

This is what needs to be resolved first. If there is no desire and / or need - go to freelance, pay someone who fumbles.
You came to the forum of those who fumbles. Here it is customary to help other people start fumbling. And they really don’t like people who just want what would be done for them for free.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question