|Posted: Sun, 2006-08-13 21:29|
I've been knocking around the docs for a couple of days now and I'm kind of stuck. What I would like to do is get a bunch of my own vars from a (non-g2) database and display them as part of a template.
Ultimately, this will probably go the route of a fully embedded integration, but I'm not able to do that yet.
The long version is that I run a small blog system, home-brewed (long story). The blog system has a set of about 20 templates for people to choose from. I was going to set up corresponding templates in G2, so if someone jumps from the blog to the album, the template essentially (visually) stays the same. My G2 is set up as a non-embedded install, with the blog users that have galleries each owning their own album. (actually, it's all in a G1 setup presently which is live, but I'm going to migrate it to G2 soon). So yes, you can see that ideally this is should be an embedded install, but in the meantime because I have bunch of users and photos in the system, I just wanted to run parallel templates and not be too concerned integrated admin and users and all that stuff.
So at a very basic level what I want to do is place a block of code in g2 - like a module - that will grab the owner of the album, hit the blog mysql db and find the corresponding owner of the blog (usually the same but not always), and return some info about their blog - the title of the blog, the URL (so i can build a 'back to blog' link), some nav bits, etc. Then I'd load the info coming from the blog DB as smarty vars so that I can drop them into the corresponding g2 themes. I want one block of my own php code feeding all the themes in g2.
I've gone through the module development tutorial, and have pretty much identified that is the place i need to be for doing this kind of thing. Where the tutorial leaves off is where i need to go, i.e. how do I reference the g2 variables (like the owner of the album the user is currently browsing) in order to pass that to my blog db function, and how do i take my vars and make them available to smarty?