I'm trying to create a new display block for the Banners module based off of Presentation Slide from DynamicDrive.com. Based off of my rusty knowledge of PHP and arrays, and such, I'm figuring I need to write a function to return the needed arrays, so I'm building off of the banners_users_display() function. But it's been a while. If I'm not mistaken, what I need to do is build two arrays, the first an array of the image urls, and second the click urls to pass to the template. I just can't recall how to do it anymore.
--
Home Page | Find on Facebook | Follow on Twitter
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- rgasch created topic »Using PageUtil::addVar() to load script code« 11:48 AM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
New block for the Banner module... Need some array guidance.
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6859
-
- Rank: Developer
- Registered: Aug 23, 2003
- Last visit: May 31, 2010
- Posts: 1428
shouldn't be too hard. You can make a PHP array in you PHP function and fill it with your images:
Code
You can then assign this var to the template
Code
render->assign('banners', $banners);
and then use it in the template where you call the DD script also with a loop, not written out entirely, but I hope you get the idea (check out other templates for the exact lang constructions):
Code
"foreach $banners as $banner"
dropimage[0] = $banner.image;
dropurl[0] = $banner.imageurl;
"endforeach"
--
campertoday.nl, Module development, Dutch Zikula Community -
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6859
I think that's what I ended up doing in the PHP, or something similar at least. I'll play with the templates later, it's too late now :)
edited by: HalbrookTech, datetimebrief
--
Home Page | Find on Facebook | Follow on Twitter
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6859
Alright, got that one working, unfortunatly, I decided on a different rotation script, and to use it, I need to be able to tell when I've got the last item in the array, because the data array for this script there needs to be a comma after all but the last. I found some info on the Smarty modifier for .last, but how to I use it in Render?
--
Home Page | Find on Facebook | Follow on Twitter
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6859
argh, I figured it out, had it working, decided to try and tweak something else, and now it broke and I can't figure out what I did to it.. Gotta remember to save a working copy before I start changing.
--
Home Page | Find on Facebook | Follow on Twitter
-
- Rank: Developer
- Registered: Dec 31, 1969
- Last visit: Jun 01, 2010
- Posts: 6859
And evidently it had something to do with there being 2 blocks active at the same time, working again. Got more work before i can release it as some stuff is currently hard coded to the specific site but you can see it in action at http://new.peopleschurchvancouver.org on the main page.
I need to make the dimensions configurable, and I'd like to bring several different methods in to one block, rather than right now i have 1 that does the above referenced style, and the one that's active.
--
Home Page | Find on Facebook | Follow on Twitter
- Moderated by:
- Support
