paulmagm
-
Posts
31 -
Joined
-
Last visited
Posts posted by paulmagm
-
-
Maybe i did it the wrong way. You can delete this thread. Sorry.
-
12 minutes ago, requinix said:
Insert what number into where?
What exactly is it you need to do? What's wrong with the HTML/PHP you have now?
If i add the normal price like in min="0" max="61000" and value="59800" my progress bar is also nearly full. I think i have to calculate some % numbers to show a realistic progress bar? To show the range of the day (last 24h) in the progress bar.
-
2 minutes ago, requinix said:
You try to echo the articles on a different page and... what? What happens? And given that you're doing this on a different page, is the code for category.php or loopnew.php even relevant?
I have no idea how it could work. maybe someone can give me some tipps how i can output the last loop of a category.
-
Hey,
i have a page with a php script which can show all articles on each category. Like here: https://coinfeeds.de/category/sol
category.php is like this<?php block('content'); ?> <div class="container px-md-1 mt-3"> <?= breadcrumb_render('<ol class="breadcrumb my-1 px-2">', '</ol>'); ?> <div class="row no-gutters"> <div class="col-md-12 col-lg-8 px-0 px-md-2"> <?php if (has_items($t['latest_posts'])) : ?> <div class="row"> <?php foreach ($t['latest_posts'] as $t['loop']) : ?> <?php insert('partials/loopnew.php'); ?> <?php endforeach; ?> </div> <?= $t['pagination_html']; ?> <div class="mb-4"></div> <?php else : ?> <?php insert( 'partials/empty.php', [ 'empty_message' => __('no-posts-found-home', _T) ] ); ?> <?php endif; ?> </div> <div id="hidden-xs"><div class="col-4 col-md-12 col-lg-12 p-0 px-md-2"> <div class="sidebar sidebar-right"> <?php insert('partials/site_sidebar_right_cat.php'); ?> </div></div> </div> </div> </div> <?php endblock(); ?> <?php extend( 'layouts/basic.php', [ 'body_class' => 'category', ] );
and loopnew.php like this
<?php /** * Fires before basic news loop */ do_action('news_loop_before'); ?> <div class="col-md-4"> <div class="card mb-4 box-shadow"> <a href="<?= e_attr(post_url($t['loop'])); ?>" class="post-img-link" <?= post_attrs($t['loop']); ?>><img class="card-img-top" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFElEQVQYV2N8+vTpfwYGBgZGGAMAUNMHXwvOkQUAAAAASUVORK5CYII=" data-src="<?= e_attr(feat_img_url($t['loop.post_featured_image'])); ?>" alt="<?= e_attr($t['loop.post_title']); ?>" class="post-feat-img img-zoom"></a> <div class="card-body h-100"> <div class="post-title-category mt-2 pb-1"><?= e_attr($t['loop.category_name']) ?></div> <div class="post-title pb-1" title="<?= e_attr($t['loop.post_title']); ?>"> <a href="<?= e_attr(post_url($t['loop'])); ?>" <?= post_attrs($t['loop']); ?>> <?= e(limit_string($t['loop.post_title'], 68), false); ?></a> </div> <p class="card-text pb-1"><?= e(limit_string($t['loop.post_excerpt'], 80), false); ?></p> <div class="d-flex justify-content-between align-items-center"> <div class="btn-group"> <span class="badge badge-cat"><i class="fas fa-newspaper"></i> <?= e_attr($t['loop.feed_name']) ?></span> </div> <small class="text-muted">vor <?= time_ago($t['loop.post_pubdate'], _T); ?></small> </div> </div> </div></div> <?php /** * Fires after basic news loop */ do_action('news_loop_after'); ?> <?php $t['__loop'] = $t['__loop'] + 1; if ($t['__loop'] === 4) : $t['__loop'] = 0; ?> <div class="adblock"> <?= get_option('ad_unit_3'); ?> </div> <?php endif; ?>
Now i try to echo the articles from a category on a different page.
$catId = 1; $filters['where'][] = ["{$postsTable}.post_category_id", '=', $catId];
But i m not a php coder, maybe you can give me some tipps how i can reach my plan.
Thank you for your time! -
Hey,
i m trying to create a progress bar of price range. Like the image at the end of my post.
I have both prices, but i have to calculate some different numbers, otherwise my bar is with this prices always near full.<progress class="tw-flex-grow tw-w-full high-low-range-slider tw-mt-3" min="0" max="<?php echo file_get_contents('/shortcode/text.php?coin='.$t['page.content_slug'].'&info=high_24hr'); ?>" value="<?php echo file_get_contents('/shortcode/text.php?coin='.$t['page.content_slug'].'&info=low_24hpr'); ?>"></progress>
my values are here..
case 'low_24hr': $text = '' . $coin->low_24h . ''; break; case 'low_24hpr': $text = '' . $coin->price_usd . ''; break; case 'high_24hr': $text = '' . $coin->high_24h . ''; break;
My two questions are. Do someone have an idea how i can calculate a number for the progress bar and how i have to insert this calculation in my values.
Thank you.. already. I*m not a pro code.. only a small frontend guy.Thank you very much.
calculate price range for a progress bar
in PHP Coding Help
Posted
Yes i found out that to calculate in JS. is very simple. What is %max in your example?
What would calculate for max and value in <progress ... max="" value="".