If Links

Tell us about your wildest feature dreams. Or just harmless suggestions for improvement.
Post Reply
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

If Links

Post by DreamStatic »

Would it be possible to set up [linksBegin] to be [linksBegin:Movie] or [linksBegin:Review] or [linksBegin:Wallpaper] whereas the "Movie", "Review", and "Wallpaper" would actually be the text you have in your Link Type field. This way if you have a movie wallpaper you wish to display in an HTML Export Template it would only show that bit of code if a Link Type of Wallpaper was present, it would not repeat that bit of code for all your links. Also, you could have a bit of code that does something different for your digital movie file, review links, etc. The possibilities are endless at that point.

Does that make sense? [linksBegin] could remain as the way to export all your links with the same bit of code, like it is now. So it would be backward compatible. :)

Thanks for always listening, appreciate it. :)
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Re: If Links

Post by DreamStatic »

Did I scare you with this one or you just waiting to give it to me for Christmas? :)

J/K :lol: , did I explain it in a way that made sense? Do you think it would be a more flexible way to handle link exports? What are the hurdles involved in this idea?

Off Topic: I am thinking of tackling learning Cocoa, but don't have any Objective C experience. Since I respect the quality of your products and you, do you have any advice on getting started? I don't want to start off on the wrong path and become frustrated. Any books, videos, etc that you have heard or found to be good?

Thanks again. If you celebrate the upcoming holidays, I wish you and yours the best.
User avatar
Conor
Top Dog
Posts: 5345
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: If Links

Post by Conor »

What you propose it a bit complicated to do due the way the the export is divided in many functions that work independently of each other. It's also a very specific need that can be handled via JavaScript. Since your willing to learn some Objective-C, JavaScript should be no hassle. You would export [link:type] to the ref of an enclosing div. Then in the JavaScript you would have a function that looks for all the link DIVs and hides those that are not of the type you seek.

Template:

Code: Select all

<div ref="[link:type]"><a href="[link:url]">[link:name]</a></div>
JavaScript written here without testing:

Code: Select all

function removeUnwantedLinks() {

    links = document.getElementsByTagName('div');   

    for (indexX in links) {
        nextLink = links[indexX];
        if (nextLink.ref != 'Wallpaper') {
             nextLink.style.visibility = 'hidden';
        }
    }
}

<body onload="removeUnwantedLinks()">
Thrilled that you are learning Objective-C. One of the strongest resources is the Apple documentation it is excellent and the most up to date with new developments in Objetive-C. So when working with Xcode get used to option clicking on function names to go to the documentation and then following the link on the left sidebar to the guides. It's something that you will be doing once you learn the language anyway. I spend more time in the documentation reading, browsing sample code and thinking about something than actually writing code. Apple does have some good starting guides, and the [url=file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/KeyValueCoding.html]Key Value Programming[/url] and [url=file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_6.html]Bindings[/url] are worth reading as they are so fundamental to the way Apple structured the language. But to bring it all together you do need a book. Aaron's from The Big Nerd Ranch book Cocoa(R) Programming for Mac(R) OS X is very good for starters, but a bit sparse on detail. To get more details you can follow it up with Programming in Objective-C 2.0 these books have the advantage of having the latest syntax. The book I used and enjoyed was Learning Cocoa with Objective-C, but is now to old to be useful. The web is a great source as well. Scott Stevenson has a great tutorial site. The mailing list is a great place to ask questions but the archives are an even better resource to search.

Best way to learn for me was to split my time in half, building simple apps that I found useful or fun and then use the documentation and the internet for reference on how to do each new feature, while also reading the book and getting ideas as I went along. Having a personal project going helps a lot with the motivation and getting right into it. Welcome to the club.

Happy holidays.
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Re: If Links

Post by DreamStatic »

Wow, thanks for that bit of Javascript. That should work if I was wanting to remove the code from the export template, but instead I am wanting to have different code tidbits for different links. For instance, in the two examples below you could have it export unique code based on the [link:type]. Maybe it would be better suited in the <!--IFlinks as <!--IFlink:Wallpaper? May not be feasible, but in reality if it were, you could actually use DVDpedia to build a complete Web site. Would make the "homemade" Web sites more versatile.

(non working code, just examples)

Code: Select all

Wallpaper example code:
Export code: <!--IFlinks [linksBegin:"Wallpaper"]<div id="wallpaper">
				<a href="[link:url]"><img src="http://static.wallpaper.com/images/thumbs/[link:name].jpg" alt="[link:name]"/></a>
				<h2 class="title"><a href="[link:url]">[link:name]</a></h2>
				<span class="date">[key:dateAdded]</span>
			</div>
[linksEnd] ENDlinks-->

Code: Select all

Video example code:
Export code: <!--IFlinks [linksBegin:"Movie"]<div class="full_title">[link:name]</div>
<div class="description">[key:summary]</div>
<div class="date">[key:dateAdded]</div>
<div class="duration">[key:duration]</div>
<div class="rating">[key:rating]</div>
<div class="rated">[key:rated]</div>
<div class="watch_this_video"><a href="[link:url]">Watch [link:name] now</a></div>
[linksEnd] ENDlinks-->

THANKS SO MUCH for the programming guidance. I agree with your idea of having simple apps and larger personal project at the same time going. Very nice idea. The links are indispensable since I know you know what you are talking about. The Programming in Objective-C 2.0 was one the books I was thinking of getting when it releases. Glad to know I was heading down at least one right path. I appreciate you taking the time to type all of that out. Really helpful for a newb like me. Hopefully, I can offer up a plugin or two for DVDpedia someday. :)
User avatar
Conor
Top Dog
Posts: 5345
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: If Links

Post by Conor »

Your linking idea is even more complex than I had imagined. :) Through the DVDpedia plug-in architecture you have full access to your information. One of your Cocoa projects can be building your own export function that handles each link type differently.
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Re: If Links

Post by DreamStatic »

:lol: I don't think I would have the knowledge to pull that off. But it would be a valuable learning experience trying. :)
noisyscott
Addicted to Bruji
Addicted to Bruji
Posts: 40
Joined: Mon Feb 12, 2007 10:48 am

Re: If Links

Post by noisyscott »

Sorry to bump such an old thread, but I am trying to adapt this dynamic javascript hiding to the iPhoneGrouped export template and have found that adding your javascript to the template disables the index functionality. Conor, sorry for using your untested code but this was just the solution I was looking for. My intent is to use the DVDpedia html export template to display only linked images in the exported web page.

I'm going to do some debugging on my own, but figured I'd just throw this out there in the mean time.

I am sure there is something very simple here that I am missing. I am really just cutting and pasting things together in an attempt to get it all working. Any and all help is appreciated.

Here is my addition to iPhoneGroupedDetails.html

Code: Select all

<!--IFlinks
[linksBegin]
	<div ref="[link:type]"><img src="../../images/[link:name].jpg" border="0"/></div>< br/>
	<br>
[linksEnd]
ENDlinks-->
and here is my full javascript.js file as located in the iPhoneGroupedImages folder

Code: Select all

function toogle(visibleLayer)
{

 if (document.getElementById(visibleLayer).style.display == "none") {
 	document.getElementById(visibleLayer).style.display = "";
 	document.getElementById(visibleLayer + "Show").style.display = "none";
 }
 else {
  	document.getElementById(visibleLayer).style.display = "none";
 	document.getElementById(visibleLayer + "Show").style.display = "";
 }
}

function removeUnwantedLinks() {

	links = document.getElementsByTagName('div');   

	for (indexX in links) {
    nextLink = links[indexX];
    if (nextLink.ref != 'Image') {
    	nextLink.style.visibility = 'hidden';
        	}        	
	  }
    }

<body onload="removeUnwantedLinks()">
noisyscott
Addicted to Bruji
Addicted to Bruji
Posts: 40
Joined: Mon Feb 12, 2007 10:48 am

Re: If Links

Post by noisyscott »

Just reporting back that I was able to fix the broken index menu by doing the following;

First I added a class declaration to the links div

Code: Select all

<!--IFlinks
[linksBegin]
	<br>
	<div class="links" ref="[link:type]"><img src="../../images/[link:name].jpg" border="0"/></div>
[linksEnd]
ENDlinks-->
next I figured that I had to move the removeUnwantedLinks function out of the javascript.js file and into the actual iPhoneGroupedDetails.html file like so:

Code: Select all

<!--BeginRepeat-->
<title>[key:title]</title>
</head>
<body onload="removeUnwantedLinks()">
Now all is working again and I have a nice way to display any linked images in my template.

Thanks again for the Pedias Conor and Nora!

Scott
User avatar
sjk
Addicted to Bruji
Addicted to Bruji
Posts: 529
Joined: Sat Feb 21, 2009 9:01 pm
Location: Eugene

Re: If Links

Post by sjk »

noisyscott wrote:Sorry to bump such an old thread
Check your PM. :)
Post Reply