Profile Type: courses (thing)

greetings,

we would like to display our major courses on our majors pages. i created a Data Source that hooks into a mariadb database. i created a global profile type to use that data source for the various profile fields (e.g. title, description, department, course number, credits). then i attempted to create a widget to display those courses based on department, but nothing appears in the widget output.

is there a step that i missed?

thanks in advance.

yours,

steve

Did you create any profiles in that type? Sorry if that’s a dumb question, but you didn’t explicitly state it so I wanted to make sure.

hello, jon,

i did not create any profiles for that type. in fact, livewhale would not allow me to create any profiles of that type because the title field is restricted. see attached screenshot. i assumed that was the case because the profile data are coming from the data source.

anyway, does that mean that we have to create a profile for each course?

thanks in advance.

yours,

steve

A small aside: we appear to have a custom module (presumably added by LiveWhale long ago when we integrated courses) that allows for widgets to be made directly from data_source data, rather than having to link them to profiles.

I assume we have this approach because we didn’t intend to append/edit any of the content from the data source. Not sure of the relative pros/cons of two approaches, but if that’s a fairly “generalized” custom module, perhaps it could be an alternative approach to consider.

Thanks,
Nick

Creating a profile type with synced fields does not automatically create profiles. You still need to do that manually.

In your case, since the title is synced, you would need to enter the “Course Catalog: disc” value in the Syncing field and click “Sync now”. That should populate the title and other synced fields and allow you to save it.

There are probably other automated ways to create profiles, but I don’t have experience with that.

hello, nick,

that sounds perfect! is that something that you can share?

thanks in advance.

yours,

steve

Hello Steve,

Given it’s sitting in our client folder, I presume I can. I make no promises or guarantees about it.

You’ll have to define the sources in /includes/sources/, including the livewhale source. (I had to remove our database password from the file.)

In our case, the course data is synced nightly into the livewhale database as its own table. We do it this way for security: better to have the remote source give the webserver the data, then to have the webserver access the secure remote source.

Thus, depending on what you’re working with, you may have to define a unique source rather than a table like we did.

Thanks,
Nick

1 Like

perfect. i’ll have a look. thanks!

just saw this - we have several pages that use widgets to display information from data sources without creating profiles. It is a good way if you don’t need to display extra data that isn’t in the data source (then you need a profile for that). If you have questions, please feel free to reach out - I’m happy to discuss or demo it…

-= G =-

sounds just like what we need. how do you accomplish that?

sorry - just saw your reply.

Here’s an example page:

https://brockport-dev.livewhale.net/support/university-communications/design-marketing/licensee-list/

We have a csv file stored at : /livewhale/core/integrations/data_files/licensees/licensee_list.csv which the widget uses as its data source. You might need help from LW to set that up if you don’t already have the integrations directory setup. The widget just pulls fields from the .csv file and displays them. Whenever we update the file, the page updates to match (sometimes subject to a caching delay).

And here’s the code for the widget on that page:

<widget type="data_source">
<arg id="source">licensees</arg>
<arg id="table">csv</arg>
<arg id="clean_markup">true</arg>
<arg id="format"><tr> <td> <span class="vendor_name"><strong>{Licensee Name}</strong></span><br /> <strong>phone:</strong> <span class="vendor_phone">{Phone}</span><br /> <strong>address:</strong> <span class="vendor_address">{Street Address}<br /> {City}, {State} {Zipcode}</span><br /> <strong>contact:</strong> <span class="vendor_contact">{Contact}{ - <a href="mailto:{Email}">|Email|</a>}</span><br /> </td> <td> <strong>products:</strong> {Products}<br /> <br /> <strong>channels:</strong> {Channel(s)} </td> </tr></arg>
<arg id="format_widget"><table class="licensee_listing"> <thead class="lw_sr_only"> <tr> <th> Vendor Info </th> <td> Vendor products and channels </td> </tr> </thead> <tbody> {widget} </tbody> </table></arg>
</widget>

I think that about covers it but let me know if you need more.

Again, sorry for the delayed response…

Best,

-= G =-