Easy enough.  My module uses a hook into drupals views, when a node is
about to be rendered to the screen, I have a function that generates a
hash based on the url of the node id.

Then using drupal_add_js, I write out the jQuery function and drop in
the vars from the module's php code (naybe not standard but very easy
to do using this function).

Since the hash code is generated from the node's url' I know the id of
the node and where I now want to put it.

Really I should have thought of it before, but today was a rather
testing day for other reasons, with far too many coffee and cigs and
not enough work.

On 12/4/06, Erik Beeson <[EMAIL PROTECTED]> wrote:
> What you're talking about trying to do with .addClass doesn't make sense. It
> sounds like you want something like what Alex described. How do you expect
> to map from node number to class name?
>
> --Erik
>
> On 12/4/06, digital spaghetti <[EMAIL PROTECTED]> wrote:
> >
> > To be honest, I don't know how to currently with drupal, I've looked
> > through the docs but currently haven't found anything to allow me to
> > affect the node's class tag.
> >
> > This way seemed like a quick workaround way to do it, and as far as I
> > could see drupal_add_js was designed to be able to do stuff like this
> > (mix JS and PHP, maybe I'm wrong).
> >
> > I do want to look for a more perminant way of doing this, as I have
> > thought that a microid spider might ignore JS which would render this
> > module's current implementation useless.
> > But at the moment this is more of a proof-of-concept rather than
> > something fully useable (there are not many services that support
> > microid).
> >
> > Tane
> >
> > On 12/4/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> > > digital spaghetti schrieb:
> > > > Since drupal_add_js allows me to mix PHP variables with jQuery code I
> > > > could change the I'd selector to be specific to the node I'd (I.e
> > > > id="node-14", id="node-15", etc) as drupal always automatically
> > > > generates this.  If anyone can think of anything else, it will be
> > > > appreciated.
> > > >
> > > It sounds like you should try to add that ID without JS at all. I think
> > > mixing of javascript with any serverside code should be avoided as much
> > > as possible, it always gets ugly. Use metadata added via serverside code
> > > within your js code, but don't generate js.
> > >
> > > I'm interested to hear why you need js to do that stuff.
> > >
> > > --
> > > Jörn Zaefferer
> > >
> > > http://bassistance.de
> > >
> > >
> > > _______________________________________________
> > > jQuery mailing list
> > > discuss@jquery.com
> > > http://jquery.com/discuss/
> > >
> > _______________________________________________
> > jQuery mailing list
> > discuss@jquery.com
> > http://jquery.com/discuss/
> >
>
>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to