Jump to content

Small modification to domainpricing.php (data feeds).


-M-

Recommended Posts

Hi (seems it's question day today :twisted:)

 

I never knew anything about the existence of 'Data Feeds' (thanks again for pointing that out brian!).

 

Anyways, I need to make a small modification to the 'domainpricing.php' so it adds a simple text to it's output.

 

Here is most of the code from it:

 

$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"];
   $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."');";

 

I am guessing that the variable I want to "modify" is the one called $year.

 

Now it displays just 1, 2, 3, etc. (amount of years for minimum registration period).

 

I want it to show 1 jaar, 2 jaar, 3 jaar, etc. So I don't only want a number but also the term "jaar" behind it.

 

I tried various things, but I get a blank page (improper coding clearly) or I don't get "jaar" added... :(

My "best" try so far:

 

$jaar = $year . "jaar";
<snip>
$jaar,

 

The word 'jaar' is not being added...

 

Normally this is the correct way to display text behind a variable right?

...what am I doing wrong? :(

 

Regards

Link to comment
Share on other sites

you're going to like this... :)

 

what you need to do is change the table output line...

 

'<tr><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td></tr>',

to...

 

'<tr><td>%s</td><td>%d jaar</td><td>%s</td><td>%s</td><td>%s</td></tr>',

 

Aaaaaaaaargh.... Now that you showed me, it makes complete sense.

I don't understand why I am doing everything the hard way...

 

Thanks for answering my foolish question brian! :)

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