By Juryiel on
I'm trying to generate a view result that is in simple text format instead of being embeddedin any sort of HTML. Basically, in the case of say, using a Page display, I would like navigating to the pathto produce just the views results in text format and nothing else. Is this something simple to do? (THe Page display type need not be used if there's some other display type that will do this, but I can't seem to find any)
Comments
There are different ways to
There are different ways to accomplish this. The best way is (in my oppinion) to do this in the view itself. You can define how your output will be. In the field you can add the body-field and check the ouput-setting "Trim this field to a maximum length", we do not want to trim, so just leave the field blank, but check the setting, strip html tags.
Another way to do this is to create an input filter that strips all html and set this as default for the specific node-type.
You can also accomplish this by modifying the node-template, but this is not the correct way or place to do this. At this point the output must be in the correct format already.
I'm not sure I understand
I'm not sure I understand this right. Wouldn't going to the View page path still produce all sorts of website-related html? Right now for example, it's not just the view that shows up if I navigate to teh page path, but also the side bars, the header/footer bars, etc etc. I would basically want the path to output query related results in text and nothing else.
Ok, so you want the output be
Ok, so you want the output be just text and nothing more, no doctype, no bodytag, just the plain text. I don't know the reason why you would do this (there are maybe better solutions), but you can theme this page (view) with a new template (see template suggestions template suggestions of views and http://drupal.org/node/190815).
There may be better
There may be better solutions, it's hard for us noobs like me to figure them out though :) I guess one way would be to pull out the data directly from the view results array and I read some stuff about that and I'm working on that end also but it's a bit complicated and will take me time to figure out. I'll try your suggestion above to see if it is easier. Basically I want to have an external application read the results generated by the view without actually saving a file of the results or having any kind of write/delete file operations, so if I could point the 'source' of the input data for the external application to be something like www.examplesite.com/myviewresults, if the result of this is text I can format it as I need. If it's a ton of HTML around it, it might be hard, especially as I change themes or add more modules to the site. If you know of a better way to accomplish this of course let me know.
Ok, I had to create about 4
Ok, I had to create about 4 or 5 custom templete files specific to my view, and also to do the same for the page (page--pagepath.tpl.php), but I got it to work and to output just text. I have now used this to manage dynamic playlist creation on-the-fly by pointing the playlist location of my flash mp3 player to the pagepath, so every time that the mp3 player tries to access it, a query generates a playlist dynamically based on various things (like what page is being viewed, who is logged in, etc etc). I realize Dash Audio player does this too but it seemed like that was a much more complicated way and I couldn't use a different (simpler) player, whereas this method lets me use whatever player I choose so long as it accepts a playlist file of SOME kind, with some minor reformatting of the view output to fit the format.
I very much appreciate yoru help, as I would have never figured that out in a million years.