# Help with html\_standard coding

**URL:** https://community.mp3tag.de/t/help-with-html-standard-coding/19572
**Category:** General Discussion
**Created:** [December 2, 2017, 10:26am UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572 "2017-12-02T10:26:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![treadhead194](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@treadhead194](https://community.mp3tag.de/u/treadhead194)
#### Post date: [December 2, 2017, 10:26am UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572/1 "2017-12-02T10:26:58Z")

</div>

I would like to know how to change the coding in the html\_standard export so that a specific column is sorted on, ie: output would be sorted by artist . At the present, at least in my html\_standard output once the html is produced the result is everything all over the place. Thanks in advance

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 2, 2017, 1:48pm UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572/2 "2017-12-02T13:48:54Z")

</div>

Please have a look at the description of the export scripting.  
The sorting criterion is taken from the $loop() statement.  
These statement can be nested.

The standard html export loops (sorts) bei %\_filename\_ext% - you probably want to sort by %artist% - and then you probably want to sort by %album% and then %track%.

So instead of a simple  
$loop(%\_filename\_ext%)  
you need  
$loop(%artist%)$loop(%album%,1)$loop(%track%)  
and instead of a simple  
$loopend()  
you need  
$loopend()$loopend()$loopend()  
to close all loops.

---

<div class="post-metadata">

### Author: ![treadhead194](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@treadhead194](https://community.mp3tag.de/u/treadhead194)
#### Post date: [December 3, 2017, 12:36am UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572/3 "2017-12-03T00:36:20Z")

</div>

> [@ohrenkino](#):
>
> Please have a look at the description of the export scripting.  
> The sorting criterion is taken from the $loop() statement.  
> These statement can be nested.
> 
> The standard html export loops (sorts) bei %\_filename\_ext% - you probably want to sort by %artist% - and then you probably want to sort by %album% and then %track%.
> 
> So instead of a simple  
> $loop(%\_filename\_ext%)  
> you need  
> $loop(%artist%)$loop(%album%,1)$loop(%track%)  
> and instead of a simple  
> $loopend()  
> you need  
> $loopend()$loopend()$loopend()  
> to close all loops.

Not knowing exactly what I'm doing here but hopefully following your instructions, would this be correct?

$loop(%artist%)$loop(%album%,1)$loop(%year%)$loop(%track%)%loop(%\_filename\_ext%)  
  
\<td$if($odd(%\_counter%), class="odd",)\>$replace(%title%,&,&)  
\<td$if($odd(%\_counter%), class="odd",)\>$replace(%year%,&,&)  
\<td$if($odd(%\_counter%), class="odd",)\>$replace(%artist%,&,&)  
\<td$if($odd(%\_counter%), class="odd",)\>$replace(%album%,&,&)  
\<td$if($odd(%\_counter%), class="odd",)\>$replace(%track%,&,&)   
  
$loopend()$loopend()$loopend()$loopend()$loopend()

I always want somebody to check what I did just to make sure. I don't know after the first if that would be deleted or left as is. Would I be correct in assuming that the placement of each sort item would also be placed on the output html as it is sorted ie:artist, album and so on?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 3, 2017, 10:23am UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572/4 "2017-12-03T10:23:11Z")

</div>

> [@treadhead194](#):
>
> Not knowing exactly what I'm doing here but hopefully following your instructions, would this be correct?
> 
> $loop(%artist%)$loop(%album%,1)$loop(%year%)$loop(%track%)%loop(%\_filename\_ext%)  
> ...

I would say that an awful lot of looping is going on.  
As I am not really sure what you want to achieve, I try to translate what your statement means:

First, arrange all artists alphabetically and run through this loop for each entry for artist - I would use $loop(%artist%,1) which sorts the artists but considers each one only once.  
The sort the albums by this artist and consider it only once - which is ok, I think.  
Now sort by year - which I do not understand: I would sort either by album or by year. I would leave out year altogether. The loop-instruction to sort has nothing to do with the display of the data.  
Then you sort by track and get a list of tracks for one year - is that intended?  
and finally you sort by filename which should not be noticable as you probably have unique track numbers anyway. So I would leave that out.

The you mentioned has nothing to do with MP3tag's export instructions but is a html keyword to start a tabel row.

---

<div class="post-metadata">

### Author: ![treadhead194](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@treadhead194](https://community.mp3tag.de/u/treadhead194)
#### Post date: [December 4, 2017, 12:12pm UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572/5 "2017-12-04T12:12:31Z")

</div>

> [@ohrenkino](#):
>
> I would say that an awful lot of looping is going on.  
> As I am not really sure what you want to achieve, I try to translate what your statement means:
> 
> First, arrange all artists alphabetically and run through this loop for each entry for artist - I would use $loop(%artist%,1) which sorts the artists but considers each one only once.  
> The sort the albums by this artist and consider it only once - which is ok, I think.  
> Now sort by year - which I do not understand: I would sort either by album or by year. I would leave out year altogether. The loop-instruction to sort has nothing to do with the display of the data.  
> Then you sort by track and get a list of tracks for one year - is that intended?  
> and finally you sort by filename which should not be noticable as you probably have unique track numbers anyway. So I would leave that out.
> 
> The you mentioned has nothing to do with MP3tag's export instructions but is a html keyword to start a tabel row.

Actually I decided to just sort by artist and all that other stuff is gone. I've tried it out and it works just fine. I like to double check my work because I have a habit of screwing something up and I want to catch it. I'm a bit of a perfectionist so if something isn't the way it should be I want it fixed. I appreciate your help and patience. Happy Holidays 😃

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 4, 2017, 12:15pm UTC](https://community.mp3tag.de/t/help-with-html-standard-coding/19572/6 "2017-12-04T12:15:44Z")

</div>

> [@treadhead194](#):
>
> Actually I decided to just sort by artist and all that other stuff is gone....

It is really a pity that you never said what you actually wanted to achieve.  
I mean, if you only sort by artist, you get all the tracks from all the albums in a more or less random order. But as you say that it works just fine ...
