Jump to content

Show domain pricing in custom website


Recommended Posts

with regards to removing GBP, one option would be to change the line of code below from true to false - that would remove all currencies symbols from the pricing output, and you could then add the £ symbol back in to the output...

 

        $tldpricing = getTLDPriceList($tld, false);

and...

$code .= sprintf('<tr><td>%s</td><td><strike>£%s</strike> <font color=red>£%s</font></td><td>£%s</td><td>£%s</td></tr>',

Link to comment
Share on other sites

  • 3 years later...

Hi @brian!

I tried to replicate your table feed example and I got this error 

PHP Parse error:  syntax error, unexpected '$code' (T_VARIABLE) in /path/datafeed.php on line 13

Is this code valid for php 7.2 ?

<?php

require("../init.php");
require("../includes/domainfunctions.php");

/*
*** USAGE SAMPLES ***

<script language="javascript" src="feeds/domainpricing2.php?currency=1"></script>

*/

$code = '<table cellspacing="1" cellpadding="0" class="domainpricing"><tr><th>TLD</th><th>Min. Years</th><th>Register</th><th>Transfer</th><th>Renew</th></tr>';

if (!is_numeric($currency)) {
   $currency = array();
} else {
   $currency = getCurrency('', $currency);
}

if (!$currency || !is_array($currency) || !isset($currency['id'])) {
   $currency = getCurrency();
}

$freeamt = formatCurrency(0);
$tldslist = getTLDList();
foreach ($tldslist AS $tld) {
   $tldpricing = getTLDPriceList($tld, true);
   $firstoption = current($tldpricing);
   $year = key($tldpricing);
   $transfer = ($firstoption["transfer"] == $freeamt) ? $_LANG['orderfree'] : $firstoption["transfer"];
   if ($firstoption["register"] < $firstoption["renew"]) {
       $code .= sprintf(
       '<tr><td>%s</td><td>%d</td><td><strike>%s</strike> <font color=red>%s</font></td><td>%s</td><td>%s</td></tr>',
       htmlspecialchars($tld, ENT_QUOTES, 'UTF-8'),
       $year,
       htmlspecialchars($firstoption["renew"], ENT_QUOTES, 'UTF-8'),
       htmlspecialchars($firstoption["register"], ENT_QUOTES, 'UTF-8'),
       htmlspecialchars($transfer, ENT_QUOTES, 'UTF-8'),
       htmlspecialchars($firstoption["renew"], ENT_QUOTES, 'UTF-8')
       );
   } else {
       $code .= sprintf(
       '<tr><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td></tr>',
       htmlspecialchars($tld, ENT_QUOTES, 'UTF-8'),
       $year,
       htmlspecialchars($firstoption["register"], ENT_QUOTES, 'UTF-8'),
       htmlspecialchars($transfer, ENT_QUOTES, 'UTF-8'),
       htmlspecialchars($firstoption["renew"], ENT_QUOTES, 'UTF-8')
       );
   }
}

$code .= '</table>';

echo "document.write('".$code."');";

 

 

Edited by mihai666g
Link to comment
Share on other sites

19 hours ago, mihai666g said:

I tried to replicate your table feed example and I got this error 

it's rarely a good idea to use 4 year old code... no guarantees that it's going to work. 🙂

just use the version you have of the domainpricing.php feed as a starting point... if you need to make changes to it, duplicate it and edit the duplicate.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated