I'm trying to create a custom social button for my site that I want users to include on their site using the code below. Previously I was using iframe
which works but it had design issues that may affect the site its placed on.
Previous button.php:
<iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 50px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 60px;" tabindex="0" vspace="0" width="100%" id="I4_1397562331199" name="I4_1397562331199" src="site.com/show.php" title="Button"></iframe>
The button.php
I loaded using an iframe
also, but the iframe
I use to to load button.php
needed a lot of things added to the iframe to maintain width so I would prefer to give users a simple line of code like below.
Now i want to use:
<script src="http://mysitehere.com/button.php?sid=6587652341GFDSY"></script>
What code can I use inside that php file button.php
to basically load show.php
which includes the button css and images? For show.php
I will need to be able to append ?sid=
to it.
What i wanted to do was basically load the button with the simple line below. <script type="text/javascript" src="http://mesitehere.com/button.php?sid=6587652341GFDSY"></script>
Loading it like that rather than using iframe was a better option since it was lighter than having to use the iframe with custom style elements.
To accomplish what I wanted I simply put the contents of button.php in documentwrite like below. The code in button.php has the iframe with the proper styling and its basically just getting printed <?php echo ' document.write(\\'<iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 50px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 60px;" tabindex="0" vspace="0" width="100%" id="I4_1397562331199" name="I4_1397562331199" src="http://mysitehere.com/show.php" title="Button"></iframe>\\'); '; ?>
<?php echo ' document.write(\\'<iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 50px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 60px;" tabindex="0" vspace="0" width="100%" id="I4_1397562331199" name="I4_1397562331199" src="http://mysitehere.com/show.php" title="Button"></iframe>\\'); '; ?>
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.