Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21933 > unrolled thread

Using html5 data attribute

Started byrichard <noreply@example.com>
First post2013-11-08 09:26 -0500
Last post2013-11-08 17:49 +0000
Articles 6 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  Using html5 data attribute richard <noreply@example.com> - 2013-11-08 09:26 -0500
    Re: Using html5 data attribute Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-08 17:04 +0000
      Re: Using html5 data attribute Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-08 18:37 +0100
        Re: Using html5 data attribute Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-08 18:36 +0000
        Re: Using html5 data attribute John Harris <niam@jghnorth.org.uk.invalid> - 2013-11-09 09:59 +0000
    Re: Using html5 data attribute Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-08 17:49 +0000

#21933 — Using html5 data attribute

Fromrichard <noreply@example.com>
Date2013-11-08 09:26 -0500
SubjectUsing html5 data attribute
Message-ID<167ecvxd9ci26$.dn66xn5j59bv.dlg@40tude.net>

<a class='aplay' href='http://mroldies.net/index.php?tune=20'
data-src='http://mroldies.net/200/6020.mp3'>

This is an example of the links I use to produce my playlist.
The current javascipt recovers the information from data-src.
So I got to thinking, what if I have this instead?

<a class='aplay' href='#' data-src='http://mroldies.net/200/6020.mp3'
data-info="6020">

Problem is, I have seen dozens of sites discuss the recovery of the
attribute. But then, they leave out how you use it.
Such as the simple act of printing that information.

The php page contains the full array so there is no database involved.
I want to match photos with the current playing song.
The way I have it set up, photo names abd song names are equal.
i.e. 6020.mp3 will pair with 6020.jpg.

So how do I do this?

[toc] | [next] | [standalone]


#21934

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2013-11-08 17:04 +0000
Message-ID<0.5ee22dfa29786aa02d1a.20131108170431GMT.87r4aqvn8g.fsf@bsb.me.uk>
In reply to#21933
richard <noreply@example.com> writes:
<snip>
> <a class='aplay' href='#' data-src='http://mroldies.net/200/6020.mp3'
> data-info="6020">
>
> Problem is, I have seen dozens of sites discuss the recovery of the
> attribute. But then, they leave out how you use it.
> Such as the simple act of printing that information.

It's not at all clear that you want to do this.  You've posted other
fragments here and in a PHP groups that provide enough information that
I think the problem is not *how* to x, y or z, what *what* to do.

I don't think you have worked out the design yet -- you seem to be try
one thing and then another.  If I were you, I'd post in a very general
group like alt.html to talk about the design.  That way you can settle
on what parts need server-side code and what parts need client-side
code. 

> The php page contains the full array so there is no database involved.
> I want to match photos with the current playing song.
> The way I have it set up, photo names abd song names are equal.
> i.e. 6020.mp3 will pair with 6020.jpg.
>
> So how do I do this?

I would not use a client-side script.  I'd make the "play" link to be a
server-generated page that has the song and the pictures in it.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#21935

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-11-08 18:37 +0100
Message-ID<1472452.mSG3TjeU6D@PointedEars.de>
In reply to#21934
Ben Bacarisse wrote:

> richard <noreply@example.com> writes:
> <snip>
>> <a class='aplay' href='#' data-src='http://mroldies.net/200/6020.mp3'
>> data-info="6020">
>>
>> Problem is, I have seen dozens of sites discuss the recovery of the
>> attribute. But then, they leave out how you use it.
>> Such as the simple act of printing that information.
> 
> It's not at all clear that you want to do this.  You've posted other
> fragments here and in a PHP groups that provide enough information that
> I think the problem is not *how* to x, y or z, what *what* to do.
> 
> I don't think you have worked out the design yet -- you seem to be try
> one thing and then another.  If I were you, I'd post in a very general
> group like alt.html to talk about the design.  That way you can settle
> on what parts need server-side code and what parts need client-side
> code.

No need to leave the Big8, though; there is 
comp.infosystems.www.authoring.html.  In this case, the “very general group” 
would be comp.infosystems.www.authoring.misc.

However, keep in mind that this particular OP has a long newsgroup history 
of not RTFM, RTFFAQ, of ignoring any advice, and getting nasty when being 
told that this approach is a Bad Idea, which does not bode well for the 
future.  Like many nice and knowledgable people before you, you might be 
wasting your precious free time with this one.  You have been warned.
 
>> The php page contains the full array so there is no database involved.
>> I want to match photos with the current playing song.
>> The way I have it set up, photo names abd song names are equal.
>> i.e. 6020.mp3 will pair with 6020.jpg.
>>
>> So how do I do this?
> 
> I would not use a client-side script.  I'd make the "play" link to be a
> server-generated page that has the song and the pictures in it.

With XHR you can have both.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#21939

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2013-11-08 18:36 +0000
Message-ID<0.69b0428c0e080dfd59ad.20131108183639GMT.87fvr6viyw.fsf@bsb.me.uk>
In reply to#21935
Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
<snip>
> However, keep in mind that this particular OP has a long newsgroup history 
> of not RTFM, RTFFAQ, of ignoring any advice, and getting nasty when being 
> told that this approach is a Bad Idea, which does not bode well for the 
> future.  Like many nice and knowledgable people before you, you might be 
> wasting your precious free time with this one.  You have been warned.

Thanks.  In fact I know the history, but I've settled on a policy of
answering a question, regardless of the poster, if there might be some
general value in the reply.  I suppose this is a borderline case, but
someone else, mystified about how to design this sort of thing, might
benefit from the mention of suitable groups.  Indeed, you added some
suggestions of your own, and, even if the OP ignores then, they add
value to the thread.

<snip>
-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#21942

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2013-11-09 09:59 +0000
Message-ID<ur1s79p6412sb4t9bq3p0k2bresddq0gsg@4ax.com>
In reply to#21935
On Fri, 08 Nov 2013 18:37:04 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

  <snip>
>However, keep in mind that this particular OP has a long newsgroup history 
>of not RTFM, RTFFAQ, of ignoring any advice, and getting nasty when being 
>told that this approach is a Bad Idea, which does not bode well for the 
>future.
  <snip>

Yes indeed. It is *always* a good idea to step back and ask the
question "Is this the right problem?"

  John

[toc] | [prev] | [next] | [standalone]


#21937

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2013-11-08 17:49 +0000
Message-ID<l5j87f$qag$2@dont-email.me>
In reply to#21933
On Fri, 08 Nov 2013 09:26:12 -0500, richard wrote:

> <a class='aplay' href='http://mroldies.net/index.php?tune=20'
> data-src='http://mroldies.net/200/6020.mp3'>
> 
> This is an example of the links I use to produce my playlist.
> The current javascipt recovers the information from data-src.
> So I got to thinking, what if I have this instead?
> 
> <a class='aplay' href='#' data-src='http://mroldies.net/200/6020.mp3'
> data-info="6020">
> 
> Problem is, I have seen dozens of sites discuss the recovery of the
> attribute. But then, they leave out how you use it.
> Such as the simple act of printing that information.

If it's a string, you can print it the same as any other string, which in 
a dom environment usually means setting up a text node and appending it 
as a child node to a relevant block element.

> The php page contains the full array so there is no database involved.
> I want to match photos with the current playing song.
> The way I have it set up, photo names abd song names are equal.
> i.e. 6020.mp3 will pair with 6020.jpg.
> 
> So how do I do this?

Sounds like you need to find a mechanism to pass the data from the php 
page to the javascript on the client machine.

Now in theory you should be able to serialise a php array into a json 
data structure, and output that json data structure in the web page in 
such a way that your javascript code on the web page has access (in it's 
javascripty way) to the same data.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web