Hello Guys,
Once again, I'm musing around. At the moment, I am working on a website proto-type that allows people to submit their stories, and then the story is displayed on the site, a decently straightforward concept. I need to address the issue of how the story is displayed.
So I have my content type set up in CCK... but, now I want to create a custom page for each story. So that the content shows up in the middle, photo/contact info in the right column, etc.
Is this possible? Or would a panel have to be created for every single story? Also, how would I get the photo uploaded via the content creation form into the left column?
Suggestions? Perhaps ideas on how to display the stories?
Thanks
Back to my corner
Devon
Comments
=-=
I don't think panels is needed here. you can create a custom.tpl.php file for the theme to handle display.
see: http://drupal.org/node/190815#template-suggestions and grab the devel.module to see inside variables and pull out specific fields so that you can place them in your tpl.php file. Then style with css as needed.
o.0
My only issue with this method honestly...
my coding experience is extremely basic, and I honestly fear I'd break everything.
=-=
you can't break anything.
If the tpl.php winds up not working correctly, remove it, clear cache tables in the DB, fix what's broken.
Panels module seems like overkill for this and will likely require you to use arguments and relationships with the views.module which seems to me would require a higher level of coding understanding than working with custom theme files.
If panels is the route you want to go, I'd suggest hoping in IRC #drupal-support channel and ask around. I've not found much panels documentation that would be used for a single page display of a specific content type.
Good luck.
Thanks VM, I should hop in
Thanks VM,
I should hop in and learn anyway, so even if I don't apply it here, I will begin exploring the method you described.
Panels and views would be a
Panels and views would be a good way to go...when you first install panels you get a list of pre defined disabled panel pages...there's one called node template, and if you enable that it will allow you to set up a generic panel design for your nodes. So, one panel can be used to display many different nodes and parts of nodes. You can also add a selection context which says 'only use this when trying to view a particular content type' eg stories. You could then make a view for each part of your story node eg 'title', 'author', 'contact details', 'story body', 'story image' etc and place these views into the panes you wanted...
So, if someone clicks on story number 23, for example, the panel is loaded with story number 23's title at the top, its body down below, and all the other bits (author, contact, image etc) relevant to story number 23 positioned wherever you initially placed them in the panel layout. This happens without you needing to set the panel up for 'story number 23' - because you set up a generic one for all story nodes through node template right at the beginning.
People inputting stories into your site will now have their text/images/data pulled apart and arranged into a complex and functional views/panels displays without them even knowing what views and panels is!
This has been the best part of panels for me, and took me ages to figure out - now it seems simple and i wouldnt be without it when dealing with lots of input from users eg social sites. It also avoids any coding...
cheers, joe
oh, and for the images - the
oh, and for the images - the best way to get images into this set up would be imagefield/imagecache/imageapi as laid out in this excellent video at drupal therapy http://www.drupaltherapy.com/imagecache
This gives your users the option to easily upload an image - it is then automatically resized to your specs and available as a cck field thanks to imagefield and as such can be used in views, meaning that it can be added to any pane in panels...
WoW Joe!
Thanks a MILLION! This is going to be excellent, I remember seeing the node template, simply haven't played with it.
Could you go into the details a tiny bit more about the views? What contexts/arguements/etc. will I need to add to each for it to pull the picture, details, etc.?
Devon
I think it depends on the
I think it depends on the Node ID Argument. So in views, add a Node: NID under arguments. Then in the options select 'node' under validator and select the content type that its valid for, then under argument type make sure Node Id is selected.
Now in fields, add the things you want to display eg node body/node title/content: image etc
Save this. These are the only 2 needed, but if you want to you can add filters eg published or unpublished or content type.
Now in the live preview at the bottom type in a node id of one of your stories eg '4' and press preview. If all is set up right you should now see the field (eg node body/content image) displayed from the node you referenced.
Once this is all working you can then start putting it into panels..
cheers, joe
Identify Panel Context
Joe,
Thanks for all the help so far! Could you guide me through the panel settings a bit more?
1.I select a context...."Node" then hit "Add Context"
2.It pulls up a screen, what do I enter as the Identifier and such?
Thanks
Devon
so you have it working in
so you have it working in views...now panels - so the node template page is enabled, and you've clicked edit. Now click add variant. give it a title and click the selection rules box then continue. Then choose node type and click add, then in the pop up select your node type to display eg story. This means that for every story node, this panel layout becomes active...you can set up different variants for all your content types, to give different layout options throughout your site.
Continue, then select your layout. For the next bit you can add either views info or node info to the panes - click the cog then add content. if you click node you can choose to add node body/node title etc...and for the more complex list based stuff you can use views...if fact depending on what you want to display you may not need to use views here, but you also have the option to use it for everything. Using node body etc here automatically gets the node id from the url, and in views you have already set that argument up...you may need to confirm it when inserting views into panes.
When inserting node info, there will be a 'node being viewed' option in a drop down - this means that the panel will fetch the NID from the url, and use that to display the content.
For titles of these panes, there is a whole list of stuff you can insert - either leave blank or use something like %title to use the original node title.
Any questions just ask, but i'll be replying tomorrow now as its late here in the UK...
cheers, joe
many thanks!
Dear joecanti,
thanks! great explanation! just what I needed!!