A Few Questions About CGBlog

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

A Few Questions About CGBlog

Post by CMSmonkey »

Hi Everyone,
I have a site running CMSMS 1.11.8 and the latest modules. The site is a community-based recipe sharing site that runs off of CGBlog.

I would like to know how to do the following:
(1) Disable the expiration - when FEUs submit their recipes, it shows an expiration. I have the "By default frontend submitted articles use the expiry date" option in CGBlog's options set to No, but from the admin the articles still show an expiration.

(2) How do I organize the custom fields on the Frontend Article Submission Form Templates? The custom field code is

Code: Select all

{if isset($customfields)}
	   {foreach from=$customfields item='onefield'}
	      <div class="pageoverflow">
		<p class="pagetext">{$onefield->name}:</p>
		<p class="pageinput">{$onefield->field}</p>
	      </div>
	   {/foreach}
	{/if}
How do I call individual ones?

(3) I cannot seem to pull in my custom fields that contain 2 words. For example, I have "Cook Time" - so I use

Code: Select all

{$entry->fieldsbyname.Cook_Time->value}
Nothing shows.

(4) I have enabled FEUs to change the status so that they can leave a recipe in draft form but come back later to finish and publish it. Once they publish the recipe, it will appear with the date that it was originally drafted on and not the date it was published. Is there anyway that when they publish a recipe the date automatically changes to the current date?


Thank you in advance for your help.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: A Few Questions About CGBlog

Post by Wishbone »

1) Is there a 'submission template' for CGBlog that allows you to remove the line that asks for an expiration date?

2) It seems that you know how to do this, from your description of #3

3)

Code: Select all

{assign var=key value='Cook Time'}
{$entry->fieldsbyname.$key->value}
http://www.smarty.net/forums/viewtopic. ... f766cc7313

Be sure that the key is actually 'Cook Time', and not munged by CGBlog to cooktime, cook_time, etc. The default template shows what the key is, or use {$entry->fieldsbyname|var_dump} to see all the keys and values.

4) If there's an event registered for CGBlog for 'Save Article', you can create a UDT triggered by this event to update the database entry with the current time. A bit of PHP/MySQL experience needed.
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

Re: A Few Questions About CGBlog

Post by CMSmonkey »

Hi Wishbone,
Thank you for your help.

1) If you hide it from the Options, then it doesn't display in the submission form. However, even though I have that disabled they still show in the admin with an expiration. I checked off a "Show All Articles" option in the admin which says "If selected, all articles, regardless of status, or start and end date, will be displayed ". I am hoping that this will override the expiration and display them no matter what. By the way, since you asked, the only reference I see in the submission template for the expiration date is:

Code: Select all

<__script__ type="text/javascript">
{literal}
function toggle_dates()
{
  var elem = document.getElementById('use_expiry');
  if( elem.checked == true )
  {
    document.getElementById('datefields').style.display = 'block';
  }
  else
  {
    document.getElementById('datefields').style.display = 'none';
  }
}
{/literal}
</__script>
So it seems like it is only for hiding or showing it.

2) I ended up using {$customfields|@print_r} to figure out which fields are which, and then just used

Code: Select all

{$customfields[3]->field}
to pull them in separately. It worked!

3) That worked! Thank you.

4) There's only 3 for when Article is Added, Edited or Deleted. Bummer. This really throws off when people post their recipes because it will not show in the correct order of when they were published. :-\
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: A Few Questions About CGBlog

Post by Wishbone »

CMSmonkey wrote:4) There's only 3 for when Article is Added, Edited or Deleted. Bummer. This really throws off when people post their recipes because it will not show in the correct order of when they were published. :-\
"Article Edited" was what I was talking about. You can have this trigger a UDT that will update the timestamp each time it's saved. With some trickery it can only update the timestamp when going from draft to published and not only when saved.
Post Reply

Return to “Modules/Add-Ons”