Jump to content

Recommended Posts

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 by smile
Link to comment
https://forums.phpfreaks.com/topic/308316-time-expiration-script-help/
Share on other sites

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 by smile

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.