smile Posted February 12, 2019 Share Posted February 12, 2019 (edited) Hello, I'm using tipso.js to make a tooltip on an image. Then I use PHP time expiration script to show current or expired image with it's tooltip. I then use the <?php @readfile("URL to the php file"); ?> The script is in domain1, the @readfile stuff is pasted in domain2. The file reading is from remote domain. This pulls the whole code and inserts it in the page where it must appear. I would happily use a javascript if it can replace the PHP altogether, but I don't know how to do this I'm not much of a programmer "<script src="http://static.jsbin.com/js/vendor/traceur.js"></script><script src="https://code.jquery.com/jquery-3.3.1.min.js" type="text/javascript"></script> <script src="https://tipso.object505.com/tipso.js"></script> <link rel="stylesheet" href="https://tipso.object505.com/tipso.css"> <script> jQuery(document).ready(function(){ jQuery('.img-tipso').tipso({ //useTitle: '', //content : 'My HTML content here?', background: '#666666', //position: 'top-left' }); }); </script> <?php //SET THE TIME ZONE date_default_timezone_set('Europe/Vilnius'); //BEGIN $today = strtotime(date("Y-m-d")); $expireDate = strtotime("2017-12-31"); if ($today <= $expireDate) { //ACTIVE echo '<a href="http://www.example.com" target="_blank"><img src="http://www.petmd.com/sites/all/modules/breedopedia/images/thumbnails/cat/tn-sokoke-forest-cat.jpg" class="img-tipso" data-tipso-title="Tooltip title" data-tipso-content="<img src=\'http://www.petmd.com/sites/all/modules/breedopedia/images/thumbnails/cat/tn-sokoke-forest-cat.jpg\'/>">'; } else { //EXPIRED echo '<a href="http://www.example.com" target="_blank"><img src="http://www.petmd.com/sites/all/modules/breedopedia/images/thumbnails/cat/tn-sokoke-forest-cat.jpg" class="img-tipso" data-tipso-title="Tooltip title" data-tipso-content="<img src=\'http://www.petmd.com/sites/all/modules/breedopedia/images/thumbnails/cat/tn-sokoke-forest-cat.jpg\'/>">'; } ?>" test http://phpfiddle.org/lite Edited February 12, 2019 by smile Quote Link to comment https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/ Share on other sites More sharing options...
requinix Posted February 12, 2019 Share Posted February 12, 2019 Okay, making sense so far... What's your question? Quote Link to comment https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/#findComment-1564424 Share on other sites More sharing options...
smile Posted February 14, 2019 Author Share Posted February 14, 2019 "Okay, making sense so far... What's your question?" Well it works just fine with PHP but new CMS like pagekit etc. do not allow PHP code in pages other then templates. So the PHP method does not work. I'm trying to make js solution to do the same. Quote Link to comment https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/#findComment-1564461 Share on other sites More sharing options...
requinix Posted February 14, 2019 Share Posted February 14, 2019 Alright. Your active and expired links/images are the same. What is supposed to be different? Quote Link to comment https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/#findComment-1564463 Share on other sites More sharing options...
smile Posted February 16, 2019 Author Share Posted February 16, 2019 (edited) Thank you everyone for your replies. "Alright. Your active and expired links/images are the same. What is supposed to be different?" I copied the image code from internet and did not find same size different image but trust me the code works. I would appreciate help with barebones from my PHP code to JS so I can adapt it by populating with my data. Edited February 16, 2019 by smile Quote Link to comment https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/#findComment-1564505 Share on other sites More sharing options...
requinix Posted February 17, 2019 Share Posted February 17, 2019 WHAT DATA? You've copied some code from somewhere that doesn't do what you want, said you needed to do what you want, but not really explained what you want. Maybe what you need to do is show us the PHP that does what you want and we can change it into Javascript? Quote Link to comment https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/#findComment-1564520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.