简体   繁体   中英

How to create a dynamic html link in PHP

I tried to create a link from a piece of code such as below format:

<a href=(php code what is may be)> website </a>

The piece of PHP code that I want to create a link is:

echo $house->ownername, '</br>', $house->owneremail;

I want to get the ownername a url and the owneremail an email-url. Is this possible? And if so, how?

<div class="span3">
<?php positions_rem($params->get('view05')); ?>
<?php    if ($params->get('show_owner_line') ==1 && $params->get('show_owner_line') ==1) {
                ?>
   <div class="rem_house_contacts">
        <div id="rem_house_titlebox">
            <?php echo _REALESTATE_MANAGER_LABEL_CONTACT_AGENT ; ?>
        </div>    
                    <?php if (isset($house->agent) && trim($house->agent)) { ?>
                    <span class="col_02"><?php echo $house->agent; ?></span>
            <?php
            }
            ?>

                            <?php
            if ($params->get('show_owner_line') && $house->ownername != '' || $house->owneremail != '') {
                if ($params->get('show_owner_registrationlevel')) {
                    ?>
                    <span class="col_02"><?php echo $house->ownername, '</br>', $house->owneremail; ?></span>
                    <?php
                }
            }
                    ?>

                    <?php
            if ($params->get('show_contacts_line')) {
                if ($params->get('show_contacts_registrationlevel')) {
                    if (isset($house->contacts) && trim($house->contacts)) {
                        ?>
                    <span class="col_02"><?php echo $house->contacts; ?></span>
                        <?php
                    }
                }
            }
        ?>
    </div>

Hope someone can help me with it.

It is pretty easy to do

<a href="mailto:<?php echo $house->owneremail;?>">
    <?php echo $house->ownername;?>
</a>

Same technique can be used with normal links

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM