Author |
Message |
Registered: March 14, 2007 | Reputation: | Posts: 1,819 |
| Posted: | | | | Hello
I want to add a small window that is linked to Tags.
I'm thinking of using tags to indicate if I have the soundtrack/book of films I own. But, what I would really like is an html window that would display something like this if the tag is ticked:
Own: Book Soundtrack
If no tags are ticked I would like the box to simply be left blank (or a link to a graphic I have locally). I want to be able to customise the background colour and fonts. I would like the text to be centred in the box.
Any 'prettying' of the idea would be great.
All help much appreciated.
Thanks
Neil |
|
Registered: March 18, 2007 | Reputation: | Posts: 6,463 |
| Posted: | | | | How would you like to take a shot at it yourself?
Try this:
(1) Use MS Word (or equiv) to make a dummy layout - just as pretty as you want - fonts, colors, etc. (2) Use easy to find dummy text such as "sampletext1" to fill in places where data from profiler will go (3) Save As ... HTML to get the layout in HTML format (4) Create a new HTML section in Profiler (5) Cut and paste (replace) the HTML section contents with your layout contents (6) Preview your pretty stuff and save it as HTML (7) Now edit your HTML section and insert this immediatley following the <head> tag:
<SCRIPT TYPE="text/javascript"> <!-- <DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False"> //--> </SCRIPT>
This makes the DVD Profiler data available to the HTML page
(8) Preview again and save again. Nothing should have changed to your eyes. (9) Come back when you are finished and paste your complete HTML in a post. Then we will tell you exactly what to change to make the Profiler data show up instead of the dummy data.
How's that? | | | Thanks for your support. Free Plugins available here. Advanced plugins available here. Hey, new product!!! BDPFrog. |
|
Registered: March 15, 2007 | Reputation: | Posts: 5,459 |
| Posted: | | | | I'm currently have a bit of trouble get DP_TAGS to behave in HTML windows, if I can work out what I'm doing wrong I'll give it a go... |
|
Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | <SCRIPT TYPE="text/javascript"> <!-- <DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False"> //--> for (var i = 0; i < DP_Tags.length; i++) {
if (DP_Tags[i].toLowerCase() == "Own:/Book".toLowerCase()) document.write("has book"); if (DP_Tags[i].toLowerCase() == "Own:/Soundtrack".toLowerCase()) document.write("has soundtrack"); } </SCRIPT> |
|
Registered: March 15, 2007 | Reputation: | Posts: 5,459 |
| Posted: | | | | That's great thanks - I was tearing my hair out trying to get it to work! Turns out I was trying to use IndexOf and IE doesn't recognise it - I mean it's only been around a few years now... Panth, to get the coding exact we'll need to know exactly what your Tags are called and if they are Child Tags of any other category(ies). |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,819 |
| Posted: | | | | The tags are simply: Book Soundtrack
Neither is a child tag.
I've actually decided that what I want to do is have a graphic/picture display if the tag is ticked. I going to find the graphic so all I need is for the html window to display the graphic centred or centred & side-by-side if both tags are ticked.
Thanks north/xyrano. | | | Last edited: by Pantheon |
|
Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Quoting northbloke: Quote: That's great thanks - I was tearing my hair out trying to get it to work! Turns out I was trying to use IndexOf and IE doesn't recognise it - I mean it's only been around a few years now...
Panth, to get the coding exact we'll need to know exactly what your Tags are called and if they are Child Tags of any other category(ies). While IndexOf might not work, indexOf does. The names of all javascript functions are case sensitive. Syntax stringObject.indexOf(searchvalue, fromindex) This method returns -1 if the string value to search for never occurs. Example "Book".indexOf("Book") returns 0 "book".indexOf("Book") returns -1 "book".indexOf("ok") returns 2 "book".indexOf("ok", 2) returns 0 |
|
Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Quoting Pantheon: Quote: The tags are simply: Book Soundtrack
Neither is a child tag.
I've actually decided that what I want to do is have a graphic/picture display if the tag is ticked. I going to find the graphic so all I need is for the html window to display the graphic centred or centred & side-by-side if both tags are ticked.
Thanks north/xyrano. <html> <head> <script type="text/javascript"> <!-- <DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False"> //--> </script> </head> <body style="text-align: center;"> <script type="text/javascript"> for (var i = 0; i < DP_Tags.length; i++) { if (DP_Tags[i].toLowerCase() == "Book".toLowerCase()) document.write('<img src="book.jpg">'); if (DP_Tags[i].toLowerCase() == "Soundtrack".toLowerCase()) document.write('<img src="soundtrack.jpg">'); } </script> </body> </html> If you have a book tag AND a Book tag and you want to use both but for seperate things, you may wish to remove the toLowerCase functions in the expressions of both if statements. Like so: if (DP_Tags[i] == "Book") doc... The source of the images above are not complete thus the images will not show. They need the full path all the way down to the harddrive letter. I also belive the images above will end up in a vertical alignment and not in a horisontal alignment. That can be fixed lateron. [spelledit] Thx northbloke | | | Last edited: by xyrano |
|
Registered: March 15, 2007 | Reputation: | Posts: 5,459 |
| Posted: | | | | Great work thanks. Though you may want to edit your post - you've got <scipt twice instead of <script.
I tried this and the 2 images (well, 2 red crosses) appear side by side.
I looked again at the indexOf and for some strange reason it will work on strings but not on arrays, but all the info I can find on the web is that it should work on arrays too. I was trying to use DP_Tags.indexOf('Book') to see if it returned -1 or not. |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,819 |
| Posted: | | | | Thanks for the help.
I can't seem to get the pictures to display.
Here's what I've got in the source:
if (DP_Tags[i].toLowerCase() == "Book".toLowerCase()) document.write('<img src="C:\Users\Neil\Documents\DVD Profiler\CD and Book Graphic\book.jpg">'); if (DP_Tags[i].toLowerCase() == "Soundtrack".toLowerCase()) document.write('<img src="C:\Users\Neil\Documents\DVD Profiler\CD and Book Graphic\soundtrack.jpg">'); }
Do I need to change anything? |
|
Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Quoting northbloke: Quote: Great work thanks. Though you may want to edit your post - you've got <scipt twice instead of <script.
I tried this and the 2 images (well, 2 red crosses) appear side by side.
I looked again at the indexOf and for some strange reason it will work on strings but not on arrays, but all the info I can find on the web is that it should work on arrays too. I was trying to use DP_Tags.indexOf('Book') to see if it returned -1 or not. Thats great, that the images apeared next to eachother I wounder if DVDP use javascript 1.6 cauz thats where indexOf on arrays was implemented. array.indexOf and new in js1.6I am not even sure DVDP use IE fully since we can not use or should I say are not allowed to use, the LINK tag. Anyway... glad you got it working... |
|
Registered: March 13, 2007 | Posts: 646 |
| Posted: | | | | Quoting Pantheon: Quote: Thanks for the help.
I can't seem to get the pictures to display.
Here's what I've got in the source:
if (DP_Tags[i].toLowerCase() == "Book".toLowerCase()) document.write('<img src="C:\Users\Neil\Documents\DVD Profiler\CD and Book Graphic\book.jpg">'); if (DP_Tags[i].toLowerCase() == "Soundtrack".toLowerCase()) document.write('<img src="C:\Users\Neil\Documents\DVD Profiler\CD and Book Graphic\soundtrack.jpg">'); }
Do I need to change anything? You may want to add another \ to every \ in the paths. "\" -> "\\". |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,819 |
| Posted: | | | | Quoting xyrano: Quote: Quoting Pantheon:
Quote: Thanks for the help.
I can't seem to get the pictures to display.
Here's what I've got in the source:
if (DP_Tags[i].toLowerCase() == "Book".toLowerCase()) document.write('<img src="C:\Users\Neil\Documents\DVD Profiler\CD and Book Graphic\book.jpg">'); if (DP_Tags[i].toLowerCase() == "Soundtrack".toLowerCase()) document.write('<img src="C:\Users\Neil\Documents\DVD Profiler\CD and Book Graphic\soundtrack.jpg">'); }
Do I need to change anything? You may want to add another \ to every \ in the paths. "\" -> "\\". That worked. How do I change the background colour? | | | Last edited: by Pantheon |
|
Registered: March 15, 2007 | Reputation: | Posts: 5,459 |
| Posted: | | | | Add body bgcolor="#000000" to <body> So instead of <body style="text-align: center;"> you'd get <body bgcolor="#000000" style="text-align: center;">
This will give you a black background. Change the #000000 to the hex code for your preferred colour. There's a website here with a list: http://www.december.com/html/spec/color.html
Or if it's one of the basic Windows colours, simply type the name instead of the code (eg. bgcolor="red") | | | Last edited: by northbloke |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,819 |
| Posted: | | | | That did it.
Thanks for all the help. |
|