University Web Developers

University Web Developers

I was recently upgraded to the Enterprise Edition and was excited to begin using the widgets I had heard so much about, e.g., news pulls, photo galleries, etc. EXCEPT, there are zero pre-built widgets to dissect and figure out how to build a new one. Cue Game show loser sound effect... "WAAAH wahhh waaaaahhhh"

I get that they begin with structures, but what I don't get is how to make the variables as part of the structure and how, in the end, those would get pulled into the widget.

Here's what I'm thinking would be the end result. User wants to make a photo gallery. Adds "Widget-Photo Gallery" to their container. A pop-up window asks them to browse for a folder and voila! Photo Gallery.

If you choose to reply, Fienen and/or Falzone, type slowly so I can understand. :)

Tags: widget

Share

Reply to This

Replies to This Discussion

I am working on this exact same puzzle right now. So the answer has and audience of at least two. :)

Reply to This

I love how you call out Chris and me specifically on this, heh.

Widgets are crazy easy. I actually just finished up on one for departments to use to pull in custom listing of news from PR based on categories. It took less than an hour to set up.

If you are familiar with writing dynamic Velocity code, you pretty much won't have an issue. Let's use your case of a photo gallery (and we'll assume you're gonna use the built in gallery macro).

Create a structure with a type of widget, and call it something like "Photo Gallery." Add a text field called "Gallery Path." That's where they can put in the folder name with their pictures. Now, edit the Widget Code field, and you'll do something like this:

<h2>$widgetTitle</h2>
#photoGallery("$galleryPath")

Bam, you're done, instant widget. Now, you could start taking it further, like add fields for photo height and photo width, then set them in the widget code. That's what I usually do. When I use a widget to serve as a UI for a macro, I'll add a section at the bottom with all the optional elements you can set, and in the widget code, I see if those have been entered, and if so, add a #set() line for that macro variable.

There's also some info in the docs about how to set it up that'd probably be helpful: http://www.dotcms.org/documentation/widgets If you want some real time help, come by the IRC channel (http://www.dotcms.org/community/irc.dot) or catch me on IM or Twitter.

Reply to This

Hah, there's my name. Michael's answer is great so I won't go much farther than saying that there should be some simple examples like this in starter site. I thought there were some, but if not, then hopefully the DotCMS guys are listening and they'll put some in. You could also stop by their JIRA and put in a request: http://jira.dotmarketing.net

Reply to This

I think I've pretty much got it.

1. Create Structure - Make sure it is a widget structure type.
2. Add Custom Field
3. Learn Velocity
4. Insert Velocity and lucene query into Widget Code field
5. Have users add widget to pages and watch your site blossom.

I'm still a little stuck on #3.

Reply to This

yep. #3 is a doozy.

Reply to This

So yeah, velocity is a strange animal, but as far as programming goes .. it really is not that hard.

The main concepts you need to know are
#set - sets a variable
#if ... #else ... #end - for conditionals
#foreach ... #end - for looping

Macros -- Macros are like a chuck of code that just gets executed. They cannot return a value, but they can #set a variable.

Viewtools -- Java Objects. Velocity is Java under the hood so for the most part .. whatever you can do in Java you can do in velocity.

That is really all there is too it.

1. Check out the user guide: http://velocity.apache.org/engine/devel/user-guide.html
2. TRY it .. you're never going to learn velocity unless you get your hands dirty
3. If you can't figure something out .. join us on the irc channel .. #dotcms on freenode.

Good luck :)

Reply to This

actually... I just did it in about 2 minutes. Easy. The basic bit anyway. Now I realize that I need to create some pretty css to make the gallery not look meh.

Reply to This

RSS

Elsewhere

Latest Activity

Employment Opportunities is one of the 12 main navigation links in the header of our Web site template. Therefore, it appears not only on the home page, but on almost every page of our site.
13 hours ago
Erik Espana, Rick Gould, Gloria Edwards and 3 more joined University Web Developers
13 hours ago
I just opened my account jfduguid (at) googlewave
14 hours ago
Off topic, but the hide/show social media icon bar on your site is very well done.
14 hours ago
Global footer that says "We're Hiring". It is one of our top visited pages.
15 hours ago
Thanks for the feedback - the backstory here is that our HR office has requested to be on the homepage, but the college's Web Advisory committee has been refusing the request. I thought a link in the global footer would be a nice solution, so I'm ...
15 hours ago
"Employment at SJC" is a link in our footer that is on every page, including the homepage. We also have a prominent link in the navigation one level down under our "About Us" section. It's one of our top hits also.
16 hours ago
Share your experiences using OmniUpdate CMS
16 hours ago
We have an Employment link in the footer of every page, including our home page.
16 hours ago
OmniUpdate’s CMS business is booming and we are looking for several Web Services Technicians. Help us grow our team.
17 hours ago
Yes, we list it on the homepage. Our HR person requested this as part of our redesign about a year ago and I thought it made sense.
17 hours ago
We have a "Jobs" link in our global footer.
17 hours ago
We do have a link at the bottom of the home page in the footer. We have gone one step further however, because the footer is a common include used across everyone of our pages that is in our new template. We have about 75% of our pages using it. I...
18 hours ago
shannon johnson added a discussion
hello uwebd! we're hiring a developer here @ Rensselaer's Experimental Media & Performing Arts Center in Troy, NY. www.empac.rpi.edu. We started this search last year but then went into a hiring freeze, and now have a window where we're quickly tr...
18 hours ago
I can tell you how we do it- I work in marketing on the web team. We control the front page. I'm the content person, so I make a lot of those judgment calls. For our specific design (www.oc.edu), there are a few guiding principles. For the top ...
18 hours ago
joleflow @ googlewave.com
18 hours ago
Georgiana Cohen added a discussion
What is the editorial process for your university homepage? Specifically, I'm curious about: - what type of content gets featured (news, events, blogs, social media, contests, etc.) - number of people making decisions about what content gets feat...
19 hours ago
It is a link on our homepage and is one of our top hits as well.
19 hours ago
We don't, but it is one of the first menu items from the top drop down menu. I would say it is worth it, especially if you are a large school. We're a small school (for example at this time we have 5 only openings on campus), but that page is one ...
20 hours ago
20 hours ago

An adjunct to UWEBD. UWEBD has been in existence for more than 10 years and is the very best email discussion list on the Internet, in any industry, on any topic.

About

© 2009   Created by Mark Greenfield

Badges  |  Report an Issue  |  Privacy  |  Terms of Service

Sign in to chat!