Jump to content

paulmagm

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by paulmagm

  1. 2 hours ago, ginerjm said:

    Actually - if you had saved the formatted number before doing the entire echo statements you probably would not be seeing the -- since the formatted resulted would be a string and therefore <>  to a numeric zero.  But you didn't.

    i have both when it's 0. 0--. And i try to hide the 0 when the result is zero. I want to replace it with --.

  2. 10 minutes ago, ginerjm said:

    1 - do not write code like you just presented to us.  Use separate lines for each statement.  You won't regret it.

    2 - you should not have to enter and exit php mode for a couple lines of php code.  Unless you are poorly structuring your script.  So - break that habit.

    3 - You are asking us to give you an explanation yet we don't know WTH your code is doing to the $max_supply variable.  Are you kidding?

    max_supply is a number. what else? maybe you should go for a forum only for solutions. i will ask somewhere else for help.

  3. function price_format($price, $decimals = 2) {
        $CI =& get_instance();
        $config = $CI->config->item('mcp');
    
        $price = (float) $price;
        $formats = ["US" => ['.', ','], "EU" => [',', '.']];
        $decimals = ($price >= 1 || $price == 0) ? $decimals : ($price < 0.000001 ? 8 : 6);
        return number_format($price, $decimals, $formats[$config['num_format']][0], $formats[$config['num_format']][1]);
    
    $coinfeed_coingecko_json = file_get_contents('https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids='.$t['page.content_slug'].'');
    $coinfeed_json = json_decode($coinfeed_coingecko_json, false);
    $coinfeed_current_price = $coinfeed_json[0]->current_price;
    $coinfeed_current_supply = $coinfeed_json[0]->circulating_supply;
    $coinfeedprice_change_percentage_24h = $coinfeed_json[0]->price_change_percentage_24h;
    $coinfeed_ath = $coinfeed_json[0]->ath;
    
    ?>
    
    <?php  echo $coinfeedde = number_format($coinfeed_current_price, 0, '.', '.');  ?>

     

    I created my first api call and now i trying to connect it to my old numbers helper (function price_format).
    How can i connect this function with my new api call? If i replace $price it will not work. Thanks for your time guys.

     

  4.  <?php 
     
    ini_set('max_execution_time', 300);
    // $tick = file_get_contents('https://api.coinmarketcap.com/v1/ticker/bitcoin/');
    $url ='https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=2000';// path to your JSON file
    $data = file_get_contents($url); // put the contents of the file into a variable
    $characters = json_decode($data); // decode the JSON feed
    $api_key = 'API KEY';
    
    // echo $characters[0]->name;
    
    foreach ($characters as $character) {
    echo '<tr>';
      
    echo '<td>' . $character->{'24h_volume_usd'} . '</td>';
    
    echo '</tr></tbody>sdsdf</table>';
    }
    ?>

    But my Page is empty.. 

  5. 8 hours ago, ginerjm said:
     breadcrumb_add('Page', ucfirst($page['content_slug']));

    The first argument I simply made a change to.  The second arg I added the function to the var you were passing into the function.  Pretty simple, huh?  Of course I am assuming that your var is actually a string.  Correct?

    Now it works. Thank you very much!

  6. 2 hours ago, paulmagm said:

    And here?        

     breadcrumb_add('page', $page['content_slug']);

    i have to learn more php. too much ' for a frontend developer.

    I'm not able to add ucfirst in this line without crashing the hole website.

  7. 32 minutes ago, jarvis said:

    Because of the semi-colon at the end of each declaration and those being declared inside $data.

    You would need to move them outside like so:

    $content_slug = ucfirst($page['content_slug']);
    $content_title = ucfirst($page['content_title']);
    $data = [
    	'title' => "{$content_slug} ({$content_title}) ",
    	'meta.description' => $description,
    	'page' => $page,
    ];
    return $app->render($template, $data);
    }

     

    That works now. Thank you very much!

  8. Thanks make sense. But crashed my site. But why? This is the hole context then.

      $data = [
                $content_slug = ucfirst($page['content_slug']);
                $content_title = ucfirst($page['content_title']);
                'title' => "{$content_slug} ({$content_title}) ",
                'meta.description' => $description,
                'page' => $page,
            ];
    
            return $app->render($template, $data);
        }

     

  9. Found a way to import the result of the JS. But i still need help what exactly i have to calculate for value="" max="max price" low="0".

    example

    <progress value="document.getElementById('demo')" max="1000"> <script> document.getElementById("demo").innerHTML = document.querySelector('progress').value = (100 + 50) * 3; </script>

     

×
×
  • 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.