Closed (fixed)
Project:
Dynamic display block
Version:
6.x-1.0-rc6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Mar 2009 at 12:45 UTC
Updated:
19 Aug 2011 at 17:48 UTC
Jump to comment: Most recent file
Comments
Comment #1
webjomo commentedMy bad. Just found this in the FAQ, will try the recommendations
Comment #2
webjomo commentedHave tried the recommendations in the FAQ, still have the problem
The debug code is:
And the error is:
Comment #3
webjomo commentedI think the issue is that I am attempting to use two different views for two different instances.
How do I handle template.php if I want one instance to show one view, and the other instance to show a different view?
Comment #4
ppblaauw commentedWhen you want to use two views for different slideshow you need to create another if statement for the other view in the preprocess functions:
Like:
You need to change [THEME_NAME] to the name of the theme you use, e.g. garland.
You need to change [Name_of_view_1] to the name of the first view you use, e.g news_item.
You need to change [Name_of_view_2] to the name of the second view you use, e.g top_products.
same for the pager preprocess function.
Hope this helps you further, please let me know
If not please send a link to your Internet site, your template.php file and all the results of the drupal_set_message debug lines in the preprocess functions, so I can help you better.
Comment #5
onejam commentedI followed this code snippet to have multiple instances of slideshow blocks from different content-type so we could show the slideshow on different pages with different nodes from different section pulled in.
It works fine but the only problem is that the read more button link doesn't link to the actual full node? what's more, when clicking on the whole slideshow it only changes the slides.
The first Views isn't a problem, it only happens with the second views (ie, Name_of_view_2), like in the example code and i'm not sure what it wrong with the read more link.
Thanks,
--- EDITED ---
Okay, found the answer, seems like it was the 'next' in block config which gave me the problem, see: http://drupal.org/node/406754
Comment #6
ppblaauw commentedChanged text of issue to be more useful for other users.
Added tags
Set status to fixed.
Comment #7
DjC4 commentedI tried to implement this code, but my pre-process seems to be different from the one above. Inserting the code above and changing the theme and view names breaks both of my slide shows and returns the foreach() error.
I know I need to add another if statement for the new view (named 'news_items_e3') but every time I try to insert it i break my php :(
Here is my existing preprocess code any help would be great. I'll keep plugging away at it in the mean time.
Comment #8
ppblaauw commented@DjC4
You need to insert the if statement like below.
I added the debug lines also per view so you can see what settings and field names you have per view.
I changed the view_name already in the second if statement to: news_items_e3
You still need to rename the fields in this view.
This is the pager content preprocess function.
You need to do the same with the content preprocess function.
Hope this helps you further, please let me know.
Comment #9
DjC4 commentedOops my bad with the "content" pre-process!
When you say to edit the fields in this view, i'm not sure what I need to change. Both views are pulling from the same node type, just displaying different content. "All News" VS "E3 News" kind of thing (not sure if that makes a difference for the fields).
I tried pasting the above code in and my existing DDB would only show the pager images, not the content (just white / blank)
When running the debug the only difference I can see between them right now is the "delta" variable. the existing (working) DDB shows as 2 and my new "news_items_e3" is 4.
here is the debug code from my "news_items_e3" DDB:
Comment #10
ppblaauw commentedLike I said in the #8
This is the pager content preprocess function.
You need to do the same with the content preprocess function.
Also in the content preprocess function you need to add a second if like in the pager-content preprocess function.
If you are not able to add the second if statement for the second view, you can send the contnet preprocess function and I will add the second if statement.
As you mention: the fields are from the same content, so no need to change fieldnames like I said before.
Hope this helps you further, please let me know.
Comment #11
DjC4 commentedHere is both my Content and Pager pre process. I keep breaking my php when I try to add the if hahah. I'll keep plugging away at it in the mean time. Thanks so much for all your extra support and help with this fantastic module!
Comment #12
ppblaauw commentedHereby the preprocess functions with the added if statements.
Hope this helps you further, please let me know.
Comment #13
DjC4 commentedThanks so much! I'm still getting the error foreach() on line 47 in the upright .tpl. But my existing DDB is fine and still working great.
I'm not sure what I should look at next to fix this up. Is this likely a problem with how I setup the view? they should be identical except one has an additional "filter" in it.
I attatched a screen shot of how it's displaying right now. Just the pager theme appears.
Comment #14
DjC4 commentedSwitched this back to fixed! Because it is! I had a minor typo that was throwing off the view (I didn't know they were case sensitive) I accidentally used a "Cap" when naming the view.
Works perfectly with the code you wrote above. Thank you so much I'm so glad I have this done in time for Monday. I'll be donating to this module next pay cheque yet again. You deserve a beer my good man!
Thanks again! I can repeat this for other sorting I want to do now!
Comment #16
cgjohnson commentedthanks for this - very helpful. Sorry to reopen but I want to confirm that it's still the most current code to handle this -- I'm getting "unexpected end" errors when I add a second if statement.
(It works great with just one, but I have two nodequeues I'm using.)
Comment #17
ppblaauw commentedDid you have a look at the template.php file in #12?
Can you add your template.php file, so I can help you better.
Comment #18
ppblaauw commentedSet status to closed, assume poster solved the issue, more then 4 weeks no activity.
Comment #19
technikh commentedGreat! This worked Awesome. http://ddblock.myalbums.biz/faq#14n809