Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Weird behaviour of anchor

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
jonal
Smarty Rookie


Joined: 16 Apr 2021
Posts: 11

PostPosted: Fri Jul 02, 2021 12:14 pm    Post subject: Weird behaviour of anchor Reply with quote

I got the following capture:
Code:
{capture name="capture_1"}
    <div class="div_1">
        <div class="div_2">
            <div class="div_3">
                 <a href="{$Data.link}" class="{$Data.myclass}">{$Data.mybuttonText}</a>
            </div>
        </div>
    </div>
{/capture}

{if $Data.link}
        <a href="{$Data.link}">
            {$smarty.capture.capture_1}
        </a>
{else}
        {$smarty.capture.capture_1}
{/if}


The output if no link is given should be this:
Code:
<div class="div_1">
    <div class="div_2">
        <div class="div_3">
        </div>
    </div>
</div>


But when a link is given this:
Code:
<a href="mydomain.com">
    <div class="div_1">
        <div class="div_2">
            <div class="div_3">
                  <a href="mydomain.com" class="myclass">My Button Text</a>
            </div>
        </div>
    </div>
</a>


But the result when a link is given is this:
Code:
<a href="mydomain.com"> </a>
<div class="div_1">
    <a href="mydomain.com"> </a>
    <div class="div_2">
        <a href="mydomain.com"> </a>
        <div class="div_3">
              <a href="mydomain.com" class="myclass">My Button Text</a>
        </div>
    </div>
</div>


When I swap the inner "button" anchor with a simple <p> the result is just as it should with an anchor wrapping around everything. Only when a button with the same link as the anchor is inside everything is messed up.

Why is this happening? Maybe I'm missing something in this code breakdown. If you can't reproduce it I can send my full code.

I wrote about this about one month ago, the problem solved itself somehow. But now after I made some really small changes it's coming up again.


Thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP