By hampshire on
Hello, I have to make a bunch of different feeds in order to get real estate listings to other sites such as zillow and trulia. Each of these sites has their own specifications as to how the data should be presented. For example on page 13 (http://www.zillow.com/static/pdf/feeds/ZillowBrokerFeedsTechnicalSpecV1....) is how zillow wants the feed sent to them. I am comfortable with tpl.php and have views installed but I am not sure how to go about it, do I use Views Node Feed or Views RSS modules and what do I name my template file. Any push in the right direction would be appreciated. Thank you.
Comments
Check out the Contemplate
Check out the Contemplate module: http://drupal.org/project/contemplate
I create my templates in
I create my templates in notepad and upload them as .tpl.php files but I have had contemplate installed before and if I remember correctly it only lets me customize based on content type so I could only have one template for properties. I need one template for for each view. So if I have a view called feed_zillow and a view called feed_trulia I would need a completely different feed template for each. Can this be done using contemplate? I believe I know how to code the template file, just not how to name it and perhaps not what modules I need enabled.
Thank you.
Does anyone have any other
Does anyone have any other suggestions, can a feed even be customized using a tpl.php file? If so is there any documentation about how to name the file when it is a view?
Thanks.
_
Views, regardless of whether or not they use the rss display, are themed the same way. Checkout views advanced help and Views 2 theming. You should be able to get the output for your views just about any way you want with theming.
Thank you for the link, I am
Thank you for the link, I am using drupal 5 so I have Views 1.6 installed but have the theming guide to that as well. I have already coded the tpl.php file I just do not know what to name it and can not seem to find that info anywhere.
_
Sorry about that-- i didnt catch the d5 tag on your op. It's been a while since I've themed views1 -- doesn't the theming wizard provide you the list of file names?
The wizard provides me with
The wizard provides me with views-list-view_name.tpl.php. I put my code in that file and nothing changes, my feed still looks the exact same as it did before I created a template.
Am I going about this wrong?
Am I going about this wrong? Is there more than just writing the code and making the template file? If so could someone fill me in on what those things are, if not can someone help me figure out home to name my tpl.php file? I need about 15 custom feeds for one content type and have the code written to provide these feeds, I just can not figure out how to get that code to override what views outputs automatically. Thank you.
_
Sorry-- I don't even have a d5 site handy to play around with this. iirc, the theming wizard provides 3 things: code for the template.php file, code for the tpl.php along with the suggested filename, and some css. There's more info at Views 1 theming.
It's been awhile...
...since I used the Views Theme Wizard, but in looking at my code I see that I did have to insert a function in the template.php file called phptemplate_views_view_list_viewname, and there is a line in that function that does a phptemplate_callback to the views-list-viewname tpl file. This has to be the mechanism that is used to override the automatic views output by pointing to your themed tpl file.
My memory is vague, but hope this helps.
Thank you, yeah the
Thank you, yeah the views-list-viewname.tpl.php file and code from the theme wizard works but then I have to select list in views. If I select Views RSS: RSS Feed then the template file is nolonger used and the theme wizard only gives me the list option no rss option. Does anyone know what the template naming structure is for a feed? Is it RSS, Feed, syndication, etc, I can find nothing that says what its equivalent is to say block or list, etc.
Thank again for the reply.
subscribe
subscribe
_
I'm not sure you need the type-- based on the views theming handbook page try the following function in the tempate.php:
Perhaps I am using your code
Perhaps I am using your code wrong but entering the code you gave, changing VIEWNAME to feed_trulia and creating a file called views-view-feed_trulia.tpl.php returned header and footer and all that but nothing from the views-view-feed_trulia.tpl.php file.
On a side note is there any way to keep drupal from printing header, footer, etc. That way I could just theme a list view which already works into a xml file.
Thanks.
_
Not sure what else to try-- I setup a temp d5 site and verified the above works (i simply put
print "This is the views_view_testfeed.tpl.php fileand it displayed).As for header, footer, etc-- if you mean the site header & footer (as opposed to those of the view) it should happen automatically if the code in the views_view_VIEWNAME.tpl.php file is specified correctly.
Specifying the correct filename just makes sure your tpl.php file gets picked up as the template file to use to display the view-- it doesn't provide any default data or formatting. Once you override the default, you are responsible for providing the complete and correct code to specify the view. All of it-- including the xml definition and all the code required to display the view.
Thank you, I really
Thank you, I really appreciate all your help and will try this again today and then update everyone.
Also where did you put print "This is the views_view_testfeed.tpl.php?
Thanks
_
Right in the views-view-feed_trulia.tpl.php file-- just to make sure the file was being correctly picked up.
Oh, I see what you were
Oh, I see what you were doing, no it doesn't print unless I change
to
Also was this code above going into template.php in addition to the code the theme wizard generated or instead of the code the theme wizard generated?
Anyway once I add the
require 'views-view-feed_trulia.tpl.php';it will print "Hello World" but<?php print $node->field_county[0]['view'] ?>(that should list the county) fails to print. So assuming I am supposed to userequire 'views-view-feed_trulia.tpl.php';there must still be something wrong with my tpl.php file. I also think there is still something wrong with my tpl.php file because after it prints "Hello World" the rest of the page is then displayed, by rest of page I mean the sites header, footer, navigation, etc._
I think I'm totally mangling my explanation, lets start over with a simpler method:
'title' => views_get_title($view, 'page'),in the function to'title' => "HELLO WORLD",Let me know how it goes!
I do not get hello world as
I do not get hello world as the title. This is what I have (I changed the name of the view from feed_trulia to feedtrulia to rule out that causing a problem so that is not a typo).
Hopefully I am doing something obvious wrong. also the file views_rss.module was in modules/views on my site, assuming that was just a typo but thought I would point it out incase it is not. Oh and thanks for the new explination as I was going in a completely different direction.
Thanks again.
_
If the name of the view is 'feedtrulia' then rename the function to phptemplate_views_rss_feed_trulia. The base name to which you add the name of the view is 'phptemplate_views_rss_feed_'.
Okay, so I was naming it
Okay, so I was naming it wrong the whole time. It does seem to work now and I will soon try to figure out how to customize the output.
Thank you.
_
excellent-- good luck.
I’m not sure if I understand
I’m not sure if I understand the problem correctly, but modifying Views based RSS output isn’t too difficult (although it took me a good deal of digging to find out how it’s done :-). All you need to do is write a very short module. What I write below, works for Drupal 5.x . I’m not sure how the module business works in 6.x, but I suppose the ‘philosophy’ is still the same. Let’s call the thing “yourrss”.
The yourrss.info file could look like this:
And now the actual module in yourrss.module:
Install the module in the usual way, and activate it.
Then, depending on the taxonomy term, your feed item’s title will be either bold or italic. Obviously, you could modify everything to your heart’s content, depending on the taxonomy term.
Notice the commented-out var_export lines, which show you all variables of the $node object at hand. Very useful!
I didn’t try this actual code, so be a bit careful. But the idea works on my site. Good luck. And if I didn’t understand your problem in the first place, oh well :-).
subscribing.
subscribing.