Pragmatism in Code

Michael Percy AKA DeeEmm - Waxing lyrical about life the universe and everything software related...

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Login
Subscribe to this list via RSS Blog posts tagged in easyblog

When recently migrating the DeeEm.com site I needed a way to be able to organise the tutorials section so that each tutorial was easily accessible. This meant creating an index of blog posts so that visitors could browse through each category so see if there were any mods that applied to their site. Whilst EasyBlog makes provision for listing category titles, there is no way to list the blog posts without additionally showing an intro portion from the post itself. This is achieved using the 'Latest Blogs' module, and whilst there is a setting to control the length of text displayed, even setting this to the minimum possible value, you will still display a couple of newlines in the output.

Whilst digging though the code to see if there was a way that I could modify the CSS or core code to force the list to display as I wanted, I discovered that there is a hidden value within the administration settings for the module that hides the intro text. The solution is to manually apply this value by directly editing the database table.

The value in question is for the 'introtext' variable: (Content be taken from). This will only allow you to select between 'introtext' or 'main content'. What you cannot see is there is a third value 'Hidden'. I assume that this does not display, due to it having the value '-1', or at least it does not display in the browsers that I am using.

The solution is therefore very simple. 

using phpMyAdmin or your favourite MySQL client, browse to the #__modules table and search for the Latest Posts module you wish to edit (TIP - search for the module title + if you have just added the module it will be on the last page!). When you have found it, hit the edit button, and then scroll down to the 'params' section and search for the text "showintro":"0" . This may have the value of either 0 or 1 depending on the value of the setting in the admin section. Simply change the value to -1 and save it. Be careful not to change any of the other text.

Now you will notice that the intro text is gone, and the additional carriage returns are no longer visible.

One caveat is that if you edit any other settings within the admin section, it will overwrite this value and you will neeed to manually re-apply this fix.

/DM

Hits: 8471
Rate this blog entry:
Continue reading 4 Comments

Jcomment to EasyBlog comment migration

Posted by on in Joomla 1.7 How To's

The recent migration from Joomla 1.5 to Joomla 1.7 left me without a comments system for the tutorials section of the site. Previously this was handled by Jcomment, a great component that allows you to easily add commenting to standard Joomla articles, its only drawback, is that the Joomla 1.7 version is still some way from release.

After having taken a look at various options, including several other commenting systems, I decided that the best solution would be to import the tutorial articles into EasyBlog, mostly as this would help keep some continuity on the site. The migration of the posts went flawlessly, as expected, but this still left me with the actual comments to migrate. I briefly considered a manual migration, but then discovered that there are actually quite a few comments on the site.

After a bit of digging around I discovered that EasyBlog creates a table that cross references the old article ID's to the new ID's. This is created during the migration process and the values are stored in the '#__easyblog_migrate_content' table. Perfect for migrating the missing comments across.

Using this table I was able to change the object_id in the original jcomments table to match the new post_id for EasyBlog. I simply ran the following SQL statement from within phpMyAdmin. (You will notice that I've made a copy of the original table into the table j17_oldjcomments, just in case.)

UPDATE j17_easyblog_migrate_content p, j17_oldjcomments pp
SET pp.object_id = p.post_id
WHERE pp.object_id = p.post_id

With the correct values assigned to the comments, I deleted all unnecessary fields (all fields except `userid`, `comment`, `date` and `object_id`) and then exported the table.

I then modified the SQL in a text editor as follows: I deleted the CREATE TABLE section and modified the INSERT statement as follows...

INSERT INTO `j17_oldjcomments` (`userid`, `comment`, `date`, `newid`) VALUES

Changed to

INSERT INTO `j17_easyblog_comment` (`created_by`, `comment`, `created`, `post_id`) VALUES

I then saved the file and using phpMyAdmin I imported the new comments into the database (again using phpMyAdmin).

Now all of the comments were under the correct posts but when viewing them I found that some of them had a left-margin set within an inline stye causing the comment to shift over to the right side of the page. After a  bit of digging, this transpired to be because there was some data missing from the database. For each entry there are two fields set which relate to the comments location within the comment stream, this is needed EasyBlog allows nested comments. My quick import simply assigned zero values to these fields confusing the script as to where the comments should sit within the comment stream.

The fields should function as follows - Assuming that all comments are sequential and not nested, on the first comment the values for the two fields lft and rgt will be 1 and 2, the next comment will be 3 and 4, and so on...

Rather than get technical and write a PHP script to do the job properly, I decided to manually add the values. I simply gave all comments the values 1 and 2 for the fields lft and rgt respectively (via phpMyAdmin). I then manually edited the posts where there were more then one comment so that the subsequent posts had the values, 3&4, 5&6, etc. I used the following SQL to find the duplicate entries:

SELECT `post_id` FROM `j17_easyblog_comment` GROUP BY  `post_id` HAVING  (COUNT(`post_id`) > 1)

Fortunately there were not too many posts with multiple comments.

/DM

Hits: 2493
Rate this blog entry:
Continue reading 0 Comments

Busmans Holiday

Posted by on in General

You would think that working on websites all the time i would have an up to date site myself, the problem is, that by the time I've finished working on everyone else's stuff, i don't really feel like working on my own.  Contrary to popular belief, there is actually a life outside of the internet (it's true :D ), and whilst it can be really hard to drag myself away from the monitor, I make a point of doing other (real and tangible) stuff wherever I can. This is especially true since having children. The upshot of this is that time is at a premium and my own sites suffer, nothing gets updated.

So with new abandon, I'm setting out to update DeeEmm.com. It's been long overdue, but the time has come to give the site a bit of a spruce up. i did take a bit of a look at this some time back, but as the site is still running from the old 1.5 version, the main reason for wanting to update was to upgrade to the newer 1.7 code. Unfortunately the jUpgrade code prescribed by Joomla for migrating to 1.7 did not seem to want to work, however, there is now a new version, and the test migration I performed last night worked flawlessly.

At this time I'm planning to migrate the info over, spruce up the template a little, and maybe (maybe), add a few new features in.

One component that I've been using quite a bit on other sites is EasyBlog from StackIdeas. This will probably see it's way into the update as it's much easier to use than publishing these posts via the Joomla interface. Plus, it comes with all of the bells and whistles that you would expect from an up to date blogging platform.

In the past i've advocated the use of Wordpress for Joomla by corephp for blogging needs on the Joomla patform. I even used this in my Dolphin to Joomla migrator. But whilst WordPress for Joomla is a great way to integrate the familiar blogging platform into your site, EasyBlog is actually more feature rich and believe it or not, much easier for a novice to use, which in my opinion is the right thing to have when trying to get your non tech savvy site members to start blogging.

StackIdeas also have a couple of other great products, namely SectionX - a great (free) component for organising articles - perfect for the tutorials section here ;) and EasyDiscuss, a Yahoo answers type of Q&A plugin, which may, or may not make an appearance. I'm keen to replace the forums with it, but at the moment I'm not 100% decided.

So as you can see, there's things afoot here at the DeeEmm office, things that you will hopefully be seeing on the very near future.

Watch this space.

/DM

Hits: 1426
Rate this blog entry:
Continue reading 6 Comments