iTunes-links in titles?

andreas.wah@dru... - October 8, 2007 - 20:22

Hi! Every nodetitle on my page consists of a songname. I wonder, is it possible to automatically add iTunes Store-links to every title?

Maybe add this code
itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/
com.apple.jingle.search.DirectAction/search?term=

to the template or story.module?

Thanks in advance!

/andreas

Noone that knows?

andreas.wah@dru... - October 10, 2007 - 19:19

Noone that knows?

Perhaps you could edit the

ericatkins - October 10, 2007 - 19:51

Perhaps you could edit the tpl.php file that themes your node to include the following PHP code:

<?php
print_r
($node);
?>

The code will list variables that are available for theming. You could then edit your tpl.php file to include that iTune search string you mentioned with one of the variables available in your node.

---
Eric Atkins | Hushed Casket | Sojourn Huntsville

Could you describe a little

andreas.wah@dru... - October 18, 2007 - 18:44

Could you describe a little bit closer what you mean by the last part?

Reference these pages on

ericatkins - October 18, 2007 - 18:58

Reference these pages on theming node layouts:

http://drupal.org/node/46006
http://drupal.org/node/46012

I think you should create a new tpl.php theme file for your audio node. You should copy your node.tpl.php file and rename it to node-audio.tpl.php. node-audio.tpl.php will control the layout for audio nodes only.

You need to figure out where you want to put your link to the iTunes store. Once you figure that out, place some code in your node-audio.tpl.php file. Perhaps it's something like this:

<a href="itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/com.apple.jingle.search.DirectAction/search?term=<?php print $title?>"><?php print $title?></a>

I'm unsure WHAT terms you want to add after the itms:// search string. I took a guess and added the $title variable which will print the title of the node. To figure out what terms are available, read the two links I've mentioned above or add the following PHP code to your tpl.php file:

<?php
print_r
($node);
?>

The print_r command will print out a list of variables and arrays that are available for callback in your code.

I hope this helps get you started.

---
Eric Atkins | Hushed Casket | Sojourn Huntsville

Hmm. I'm having problems

andreas.wah@dru... - October 30, 2007 - 12:13

Hmm. I'm having problems doing this with iTheme since there's no node.tpl.php.
Any ideas?

EDIT: Nevermind, I just copied the garland node.tpl.php and put it into the itheme folder =) Everything works fine now. Thanks for the help guys!

 
 

Drupal is a registered trademark of Dries Buytaert.