How do I display Chart results in a table

alt=
duke
@musamensa
7 years ago
253 posts
Hi, please i am trying formatt my chart so the results are displayed in a table with each field displaying in individual columns.
Tanks
updated by @musamensa: 05/16/17 05:39:09AM
alt=
duke
@musamensa
7 years ago
253 posts
Am currently using chart_row.tpl
paul
@paul
7 years ago
4,326 posts
You'll need to create a template that uses html table tags.
Put the and tags outside of the {foreach} loop then inside the loop use the and tags putting the item data to be displayed for each row inside the td tags.
hth
Pa


--
Paul Asher - JR Developer and System Import Specialist
alt=
duke
@musamensa
7 years ago
253 posts
i am having issues with the tables is have changed my layout, this is the code am running

{jrCore_module_url module="jrAudio" assign="murl"}
{if isset($_items)}


{jrCore_icon icon="stats" size="28" color="ff9900"} Top 10 Singles
{foreach from=$_items item="item"}












{jrCore_module_function function="jrImage_display" module="jrAudio" type="audio_image" item_id=$item._item_id size="xlarge" crop="auto" class="iloutline img_scale" alt=$item.audio_title}






{if $item.audio_file_extension == 'mp3'}
{jrCore_media_player type="jrAudio_button" module="jrAudio" field="audio_file" item=$item}
{else}
{jrCore_image image="download.png" alt="Download" title="Download"}
{/if}




{if $item.chart_direction == 'up'}
{if $item.chart_change > 10}
{assign var="chart_image" value="hot"}
{else}
{assign var="chart_image" value="up"}
{/if}
{elseif $item.chart_direction == 'down'}
{if $item.chart_change > 10}
{assign var="chart_image" value="cold"}
{else}
{assign var="chart_image" value="down"}
{/if}
{elseif $item.chart_direction == 'same'}
{assign var="chart_image" value="same"}
{/if}


{$item.list_rank}


{if $item.chart_direction != 'same'}
{jrCore_lang skin=$_conf.jrCore_active_skin id="46" default="moved" assign="chart_postition_title1"}
{assign var="cp_title" value="`$chart_postition_title1` `$item.chart_direction`"}
{else}
{jrCore_lang skin=$_conf.jrCore_active_skin id="47" default="position" assign="chart_postition_title1"}
{assign var="cp_title" value="`$item.chart_direction` `$chart_postition_title1`"}
{/if}
{jrCore_image image="`$chart_image`.png" width="16" height="16" alt=$item.chart_direction title=$cp_title}
{if $item.chart_change > 0}
{$item.chart_change}
{else}
-
{/if}


{$item.audio_title}
{jrCore_lang module="jrAudio" id="12" default="genre"}: {$item.audio_genre} 
{if isset($item.audio_album) && strlen($item.audio_album) >0}album: {$item.audio_album}{else}{/if}
{jrCore_lang skin=$_conf.jrCore_active_skin id="49" default="plays"}: {$item.chart_count}






{jrCore_module_function function="jrRating_form" type="star" module="jrAudio" index="1" item_id=$item._item_id current=$item.audio_rating_1_average_count|default:0 votes=$item.audio_rating_1_count|default:0 }




{if isset($item.audio_file_item_price) && $item.audio_file_item_price > 0}
{if jrCore_module_is_active('jrFoxyCart')}
{jrCore_module_function function="jrFoxyCart_add_to_cart" module="jrAudio" field="audio_file" item=$item}
{elseif jrCore_module_is_active('jrPayPal')}
{jrPayPal_buy_now_button module="jrAudio" item=$item}
{/if}
{elseif $_conf.jrAudio_block_download != 'on'}
Free{jrCore_icon icon="download" size="24"}
{else}
N/A{jrCore_icon icon="lock" size="24"}
{/if}
{jrCore_module_function function="jrPlaylist_button" playlist_for="jrAudio" item_id=$item._item_id}





{/foreach}


{if $info.total_pages > 1}
{if isset($_post.module_url) && $_post.module_url == 'song_chart'}
{assign var="pb_url" value="song_chart_weekly"}
{else}
{assign var="pb_url" value=$_post.module_url}
{/if}





{if isset($info.prev_page) && $info.prev_page > 0}

{/if}



{if $info.total_pages <= 4}
{$info.page}  / {$info.total_pages}
{else}


{for $pages=1 to $info.total_pages}
{if $info.page == $pages}
{$info.this_page}
{else}
{$pages}
{/if}
{/for}
 / {$info.total_pages}

{/if}



{if isset($info.next_page) && $info.next_page > 1}

{/if}





{/if}
{/if}
michael
@michael
7 years ago
7,717 posts
Table HTML looks like this
<table><tr><td></td></tr></table>

Tr is a row

Td is a cell

--edit--
so for your foreach loop you have there in your code, each itteration of the foreach will be one row. then you layout the details you want on that row in each cell

<table>
{foreach $_items as $item}
<tr>
<td>{$item.something}</td>
<td>{$item.something}</td>
<td>{$item.something}</td>
<td>{$item.something}</td>
</tr>
{/foreach}
</table>

updated by @michael: 02/11/17 06:45:08PM
alt=
duke
@musamensa
7 years ago
253 posts
hi, thanks, i have got the hang of it now but i have trouble with $item.chart_direction images, they appear as broken images in the browser, i have located all the .png files and i have placed them in the skin/img folder and the core/img folder but still no show,

Thanks
chart_cool_down.png
chart_cool_down.png  •  589B

chart_down.png
chart_down.png  •  581B

chart_hot_up.png
chart_hot_up.png  •  488B

chart_new.png
chart_new.png  •  685B

chart_same.png
chart_same.png  •  319B

chart_up.png
chart_up.png  •  563B

paul
@paul
7 years ago
4,326 posts
They need to go in your skin /img/icons_black and/or /img/icons_white folders. Then call them with code like this (taken from the AudioPro skin) -
                            {if $item.chart_new_entry == 'yes'}
                                {$color = '339933'}
                                {$icon = 'chart_up'}
                            {elseif $item.chart_direction == 'same'}
                                {$icon = "chart_same"}
                            {elseif $item.chart_direction == 'up'}
                                {$icon = 'chart_up'}
                                {if $item.chart_change > 5}
                                    {$color = 'FF5500'}
                                {/if}
                            {else}
                                {$icon = 'chart_down'}
                                {if $item.chart_change > 5}
                                    {$color = '3393ff'}
                                {/if}
                            {/if}

                            {jrCore_icon icon=$icon size="24" color=$color title='hi'}

hth


--
Paul Asher - JR Developer and System Import Specialist
alt=
duke
@musamensa
7 years ago
253 posts
paul:
They need to go in your skin /img/icons_black and/or /img/icons_white folders. Then call them with code like this (taken from the AudioPro skin) -
                            {if $item.chart_new_entry == 'yes'}
                                {$color = '339933'}
                                {$icon = 'chart_up'}
                            {elseif $item.chart_direction == 'same'}
                                {$icon = "chart_same"}
                            {elseif $item.chart_direction == 'up'}
                                {$icon = 'chart_up'}
                                {if $item.chart_change > 5}
                                    {$color = 'FF5500'}
                                {/if}
                            {else}
                                {$icon = 'chart_down'}
                                {if $item.chart_change > 5}
                                    {$color = '3393ff'}
                                {/if}
                            {/if}

                            {jrCore_icon icon=$icon size="24" color=$color title='hi'}

hth
alt=
duke
@musamensa
7 years ago
253 posts
thanks guys, i did all that and it seems fine https://goo.gl/gxdwFo i still have issues with the position image and i cant figure out how to reduce the size of the play button.
thanks
alt=
duke
@musamensa
7 years ago
253 posts
i also noticed that i cant highlight any content on the browser,
michael
@michael
7 years ago
7,717 posts
It looks like you're trying to use icons as the chart images. Better not to. Better to just use normal skin images.

Its that icon image setup that is causing your images not to show properly.

Do the chart icons the same way you did the flags.

The play button looks good.
alt=
duke
@musamensa
7 years ago
253 posts
here is what i have done, the chart_up.png seems to work but other chart images are not working.


{if $item.chart_new_entry == 'yes'}



{elseif $item.chart_direction == 'same'}

{elseif $item.chart_direction == 'up'}
{$icon = 'chart_up'}
{if $item.chart_change > 5}
{$color = 'FF5500'}
{/if}
{else}
{$icon = 'chart_down'}
{if $item.chart_change > 5}
{$color = '3393ff'}
{/if}
{/if}
michael
@michael
7 years ago
7,717 posts
michael:...
It looks like you're trying to use icons as the chart images. Better not to. Better to just use normal skin images...

You're still using icons.
alt=
duke
@musamensa
7 years ago
253 posts
sorry wrong code
{if $item.chart_new_entry == 'yes'}
                                
                                <img src="{$jamroom_url}/skins/{$_conf.jrCore_active_skin}/img/chart_up.png">
                               
                            {elseif $item.chart_direction == 'same'}
                               <img src="{$jamroom_url}/skins/{$_conf.jrCore_active_skin}/img/chart_same.png">
                            {elseif $item.chart_direction == 'up'}
                                {$icon = 'chart_up'}
                                {if $item.chart_change > 5}
                                    {$color = 'FF5500'}
                                {/if}
                            {else}
                                {$icon = 'chart_down'}
                                {if $item.chart_change > 5}
                                    {$color = '3393ff'}
                                {/if}
                            {/if}



i have switched to skin images but only chart_up is working.
michael
@michael
7 years ago
7,717 posts
Looks like any chart_new_entry is going to display the chart_up.png image. if the chart_direction is 'same' then chart_same.png will show, the others look like they are still using an icon.
alt=
duke
@musamensa
7 years ago
253 posts
Even when I change all to skin images, only the chart_up.png images shows regardless of the chart direction

Tags