• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Entering Tags at CGBlog articles
PostPosted: Tue Mar 27, 2012 5:18 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1864
Location: The Netherlands
Not another metatag T&T, but a way to enter tags (keywords) to your cgblog and do a selection on related articles. I'll describe the steps to make it work.

But first I'd like to thank Rolf for sort of 'pushing' me to start developing this and Uniqu3 who helped me extensively and came up with a working solution. Great help guys!

1. Create a page, f.i. CGBlog (or use your regular cgblog page). Enter the same name in te alias field (Optiones -> Alias)
2. Enter at least {CGBlog}, add the option as described in the help CGBlog, however for this example it is not required.
3. Create a page and name it cgblog_logboek. Enter the same name in te alias field (Optiones -> Alias)
4. Create an Extra field (CGBlog -> Field Definition) in CGBlog and name it Tags, value tex input, 50 char long. The length is your choice as long as you create enough space to enter tags.
5 . Enter in the content field {CGBlog summarytemplate="MyTagTemplate"}
6. Create a CGBlog detail template and name it Tag_detail. Could be any name as log as it is either your default template. In case it is not your default template, enter detailtemplate="<what ever name you use>" to the tag created at 2.
7. Inside he detail template you just created, go to the part where the extra fields are checked '{if isset($entry->fields)}' Replace that part untill the closing {/if} withe following code


\$1:
{if isset($entry->fields)}
      {foreach from=$entry->fields item='field'}
            <div class="CGBlogDetailField">
                  {if $field->type == 'image'}
                      <img class="hidden" src="{$entry->file_location}/thumb_{$field->value}" alt="" />
                  {elseif $field->name == 'Tags'}
                      {if $field->name != ""} {* tags to show *}
                           <h5>Tags</h5>
                           {assign var="taglist" value=$entry->fieldsbyname.Tags->value}
                           {assign var="tagwords" value=", "|explode:$taglist}
                           {foreach from=$tagwords item=tagword}
                               {cms_selflink page="cgblog_logboek" urlparam="&tag=`$tagword`" text=$tagword|trim}&nbsp &nbsp;
                           {/foreach}
                      {/if}
                  {else}
                      {$field->name}: {eval var=$field->value}
                  {/if}
            </div>
      {/foreach}
{/if}

8. Create a CGBlog Summary template and name MyTagTemplate, or at least the same name used at 5. Replace the standard enterted code by the following code. You might noticed the lay-out of the template is put in twice. See comments inside the code. If you have/want antoher lay-out, make sure you duplicate that code at the places shown:
\$1:
<!-- Start CGBlog Display Tag Template -->
{if isset($error)}{cgerror}{$error}{/cgerror}{/if}

{foreach from=$items item=entry}
    {*check url for param tag= and compare to extra field *}

    {if !empty($smarty.get.tag) && ($entry->fieldsbyname.tags->value|strpos:"`$smarty.get.tag`" !== false)}
    {* ... here do whole summary template as you want to have it ... *}
        {if $entry->postdate}
           <div class="CGBlogSummaryPostdate">
              {$entry->postdate|cms_date_format}
           </div>
        {/if}
        <div class="CGBlogSummaryLink">
            <a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}">{$entry->title|escape}</a>
        </div>
        {if $entry->summary}
           <div class="CGBlogSummarySummary">
              {eval var=$entry->summary}
           </div>
        {else if $entry->content}
           <div class="CGBlogSummaryContent">
                {eval var=$entry->content}
           </div>
        {/if}
        {if isset($entry->extra)}
            <div class="CGBlogSummaryExtra">
               {eval var=$entry->extra}
               {* cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue *}
            </div>
        {/if}
        {if isset($entry->fields)}
            {foreach from=$entry->fields item='field'}
               <div class="CGBlogSummaryField">
                   {if $field->type == 'file'}
                      <img src="{$entry->file_location}/{$field->value}"/>
                   {else}
                      {$field->name}:&nbsp;{eval var=$field->value}
                   {/if}
               </div>
            {/foreach}
        {/if}
    {elseif empty($smarty.get.tag)}
        {* ... repeat the template so it'S not empty if someone comes to page without using urlparam ... *}

        {if $entry->postdate}
           <div class="CGBlogSummaryPostdate">
              {$entry->postdate|cms_date_format}
           </div>
        {/if}

        <div class="CGBlogSummaryLink">
            <a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}">{$entry->title|escape}</a>
        </div>

        {if $entry->summary}
           <div class="CGBlogSummarySummary">
              {eval var=$entry->summary}
           </div>
        {else if $entry->content}

           <div class="CGBlogSummaryContent">
              {eval var=$entry->content}
           </div>
        {/if}
        {if isset($entry->extra)}
            <div class="CGBlogSummaryExtra">
               {eval var=$entry->extra}
               {* cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue *}
            </div>
        {/if}
        {if isset($entry->fields)}
            {foreach from=$entry->fields item='field'}
               <div class="CGBlogSummaryField">
               {if $field->type == 'file'}
                  <img src="{$entry->file_location}/{$field->value}"/>
               {else}
                  {$field->name}:&nbsp;{eval var=$field->value}
               {/if}
               </div>
            {/foreach}
        {/if}
    {/if}
{/foreach}

9. If you go your CGBlog articles (or create new articles), you will find an extra field called Tags. Here you enter your comma separated tags, f.i.
cmsms, cgblog, whatever you like
10. By viewing your clog article, you'll see the tags you entered. Click on and you will see the articles that have the same tag. A working example can be found here http://test.uisge-beatha.eu/index.php?page=cgblog

Enjoy!

Gregor


Last edited by Gregor on Mon May 07, 2012 3:01 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 11:18 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
thank you. do you have an idea for tag suggestion in backend?
it would be nice if you start typing a tag and cmsms makes suggestions for tags which already exists.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 11:38 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1864
Location: The Netherlands
That indeed would awsome. I don't have an clue how that can be done. any volunteers?

Gregor


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 11:49 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
actually its not that difficult if we use this script: http://webspirited.com/tagit/

it provides a very neat suggestion of tags. all we need to do, is to fill the given array with all tags of all entries, which are saved in our custom field.
i will take a look into it.
quick preview: http://adrop.in/pMg


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 12:04 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1864
Location: The Netherlands
Sounds like a very nice solution. Was not aware of something like that.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 4:20 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
i was playing around with it and finally i am pretty satisfied with the result: http://www.youtube.com/watch?v=OGl1rBHFFY8

i think, i will write a complete tutorial on how to get this. it will work pretty good with your code Gregor


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 6:43 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1864
Location: The Netherlands
That really looks nice! Does it store the tags as comma separated values? In the code for sending out a tweet as soon as an article is posted, the tags are used along with the tweet --> #tag1 #tag2 etc.

Grtz., Gregor


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 6:46 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
Database looks like this…
$1:
dbview.png
dbview.png [ 59.06 KiB | Viewed 9667 times ]

therefore its very easy to use the script in other modules too!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Mon May 07, 2012 9:34 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1864
Location: The Netherlands
Well, in that case, I'm willing to give it a try ;) Nice job you've done so far!

Grtz., Gregor


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Fri Jun 15, 2012 7:07 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
to all: if you also need tagging function, read my detailed article at arvixe about tagging in cms made simple


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Thu Jul 12, 2012 6:54 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Feb 08, 2007 6:11 pm
Posts: 506
Location: Florida
I dig this a lot! Thanks!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Fri Oct 12, 2012 12:16 pm 
Offline
Forum Members
Forum Members

Joined: Wed Oct 01, 2008 9:05 pm
Posts: 28
I tried it on 1.10.3 and yes it works! Great job nicmare.
However on 1.11.1 it doesn't work for some reason that I can't figure out. What needs to be done to make it work on 1.11.1? Does anybody have the answer?
We’ve been working hard on a web build on 1.11.1 and this would be the icing on the cake.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Fri Oct 12, 2012 12:21 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
i am not sure. try to implement this into 1.11.1 and tell me what errors you get.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Fri Oct 12, 2012 12:35 pm 
Offline
Forum Members
Forum Members

Joined: Wed Oct 01, 2008 9:05 pm
Posts: 28
nicmare \nicmare:
i am not sure. try to implement this into 1.11.1 and tell me what errors you get.

I've followed the steps you describe in your tutorial http://blog.arvixe.com/add-tagging-function-to-cmsms-modules-part1/ but when I go to 'Add blog entry' in Content > Calguys Blog Module I get a blank screen. I check the source code and only get this line
\$1:
<div class="pagecontainer"><div class="pageoverflow"></div>


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Entering Tags at CGBlog articles
PostPosted: Fri Oct 12, 2012 12:46 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Aug 25, 2007 9:55 am
Posts: 1150
Location: Berlin
activate debug mode in config.php (check doc file)
and watch admin log for any errors. they should lead us to the right direction


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting