Saturday, August 11, 2012

SQL 4111 error

I got a message from one of my users that he was unable to get into his site.  Finger problems??  So I tried the site.  Basically I got an SQL Server 4111 error with a whole page full of code.  Ever heard of it?  Neither had I so I tried googling with no real joy.  There were a couple of hints like 'you've exceeded your quota'.

The interesting thing was that it wasn't just one site on the server that was having problems - most of the Drupal sites were.  With some of the sites, I could not even log in and with others once logged in, I couldn't get to the config menu without an error.

I thought for the record I should detail how the problem appears to have been sorted but giving no guarantee that it wasn't going  to happen again.  The next step was to actually read the blurb that came with the error report and there was the solution.  Errors were something like 'dr_cache full'.  Not being totally knowledgeable about Drupal, but knowing that cache is something that is stored to save time getting it from somewhere else.  The standard solution to a full cache is to clear it which should be possible through the config menu, but of course I was unable to get to the config menu.

The solution was to go to the server control console and fire up phpadmin.  From there you can get to the relevant database which of course lists all of the tables in that database.  The next step is to go through all the  db_cache tables (dr_cachefield etc) and delete everything in them.  Don't delete the actual table.  I found that there were a couple of others that were also causing problems - namely the db_watchdog and the db_queue.     

Each of these had data in the format BLOB (I thought this may be some wierd person trying to attack my database but no, it turns out that BLOB stands for a Binary Large OBject that can hold varying amounts of data - you learn something new every day!).

Once you've deleted the caches, you go back to your web site (suggest that you keep phpadmin open) and try again.  It worked for me but not on the first try.  What did happen was that the size of the error message got smaller so I was eventually able to delete cache contents until there were no more messages.  First thing I did after that was to clear the cache (not sure if that helped) and to update all my modules.

Hope this helps someone.  Let me know if it does!

Wednesday, July 11, 2012

Forms

There are a couple of options when it comes to adding forms to Drupal 7.  One is called Multiple forms which which is an API that allows you to put multiple forms into one.  


Another is Webform which is a fairly sophisticated option.  This one allows you to set up a form in such a way that the inputs are not all one below the other.  I tried using this for one of my projects but found that the main problem with is was that you are not easily able to print out the form in such a way that it can be read.  The module seems to offer only one font size which is too small for a user to complete and submit a paper copy.  On the up side, it sends an e-mail to the person who filled in the form and to any other address you ask it to.  


The problem was such that I eventually had to resort to a PDF type form which wasn't available in a Drupal module (worth looking at - its called PDF fill and you can set up PDF forms that users can complete and print on line - and of course a lot cheaper than the Adobe alternative!).  Price is $19.99.


More recently on my Marlinspike Guest Lodge site, I made use of another module called qforms .  This is a great module if you need to put something together quickly that you can use immediately.  It offers the basic forms requirements and if you use qforms extra (which at the time I tried it still had a few problems), you can get a few more forms components.


The possible down side of qforms is that the forms are all stored online and you need to go online to see the responses.  For the guest house site this is actually a good thing as you have a record of your responses easily available.


I recently had someone spamming the form and wanted to put captcha onto it.  If you haven't met the captcha module - even though the current version for DR7 is still in Beta 2, my experience is that it works very well.  A few points though:


Remember that if you are Admin and you have set the system not to ask you for Captcha input, you need to log out to test it.  


If you want to use it with qforms, you need to add an extra option to captcha to allow you to do this.  You need to go to the configuration page and choose captcha and then add the form ID at the bottom of the list.  The easiest way is to look at the source of your form and take the ID (which has dashes - something like 'qforms-submit-form' and to use this with underscores 'qform_submit_form'.  Its as easy as that.  You can see it in action on the Marlinspike Guest Lodge Contact form where I've included a detailed contact form as well as a standard contact form (in case the visitor just has a simple enquiry.

Saturday, June 23, 2012

Tricks with Panels

22/6/2012

I'm using Panels 7.x-3.2 and Drupal 7.14.  In the process of trying to get the slideshow to work I came across a few issues with Panels that I need to remember for next time (if I have the sense to check the blog first before spending a day trying to find solutions - as I did today with slideshow).

1.  Panels is great.  You can set up a node, a page, a block (mini-panel) and have a tabular css layout to get what you want.  Don't panic, however when you try to modify this layout (that is the layout of the panel blocks, you suddenly get a major error.  To avoid this happening (assuming you want to make up your own set of panels instead of using the standard ones) you first need to set up a custom layout.

The advantage of this is that if you have a number of layouts and you want to change them all at once - you just have to change the one.  More importantly you should not get that pesky error that you get when you try to modify it on the fly.

2.  There's a problem when you want to have an empty panel (well I had this problem anyway).  I wanted my slide show in the middle of the page with areas for other content on either side.  Solution is to make a blank node and put it into the panel.  New problem - its the old 'node title' problem.  Something about Drupal is that they don't give you an easy way to hide your node title - you have to do it in the .tpl file.  The easiest solution is to just comment out the line that prints the title - you do it in the PANEL.tpl file if the (blanc node) is in a panel.  Remember to use the basic node and not the article otherwise you will have author info that you can't get rid of!!)

3.  You've set up a beautiful sliding show but damn me if the thing is left justified.  You guessed it  - there seems to be no easy way to centre (or is it center) anything in Drupal - you've got to go to the css file and add:


.slidecenter{
width: 500px;
margin-left: auto;
margin-right: auto;
}

then you go to the mini-panel that you've set up for the slider under panels and ..... oh dear there doesn't seem to be any way of editing it.    For some reason when you simply click on min-panels that option doesn't come up.  The simple solution is to click onto 'content' and voila you can edit again (took a while to get to that as well!).  Anyway, when you go to content, you click on the panel that has the slider in it and choose css.  Then you add the css class (in my case 'slidecenter' and the image should now centre.

4. Returning to panels (2 years later), I had to edit the panel format - this is actually for a newsletter that I am doing.  Its a long story, but this is the best way to render the content of the newsletter - there'll be a dedicated section of this blog on that soon.  When I tried to change the layout of the panel, I go a mysterious error from 'my site'. "you are not authorised to access this page'

First step was to check my admin to see that all the boxes are ticked - they are (well there were a few that weren't but they had nothing to do with panels).  Next step (of course) was google.  Eventually - lurking at the bottom of a response from the maker - was yes, there is a problem - but I never expected people to want to do things this way!  Basically the error comes up if you edit a panel layout directly from 'edit content'.  The solution turns out to be simple - go edit, go straight to 'panel content', go to layout editor.  If you go to 'panel layout' you'll probably get the error.

The maker of panels is clearly in no rush to sort this one out as its been around for 2 years!

Here's the link to the initial report : https://www.drupal.org/node/1798846



Thursday, June 21, 2012

Views SlideShow


10/5/12


Putting together an e-commerce type site which will include the sale of computer equipment and I need to have a front page block which will display the latest specials.    The prior 'Slideshow' module looked like a suitable option as it simply provides a slideshow of the images in exisiting nodes, but this is only available to DR6 and is no longer supported.


Views Slideshow looks a lot more complicated, but I have decided to give it a go.


Installed Views Slideshow and Views Slideshow Cycle


Instructions found at http://drupal.org/node/903244


I see that all isn't as easy as it looks - its one of these modules that needs you to download something else from somewhere else.  In this case I downloaded a file called malsup-cycle and then re-name the file jquery.cycle.all.js to jquery.cycle.all.min.js and put this in a newly created directory under libraries called jquery.cycle.  Actually I SHOULD have found jquery.cycle.all.latest.js and downloaded an renamed that one.  Nothing is simple in life.


Still nothing when I look under the front page of views (but see below).


Looked at tutorial - seems to require a module called Link Field. Cleared Views Cache - no change.


Another thing I discovered was that 'slideshow' does NOT appear on the Views page.  You have to create a new view and it becomes one of the display formats.  This is really irritating because there doesn't seem to be anything that mentions this on the slideshow page - in fact it says that it should be there.


Following the tutorial worked well.  Take a look a the results at http://www.innomark.co.za.

















Monday, April 23, 2012

Simplenews

23/4 Simplenews Installation


Installed Simplenews for the Llandudno web site.  Followed all the instructions but the e-mails were still in text.  
Installed Mimemail and its related components.  Still getting text but with HTML markups.


24/4 Getting an HTML e-mail


Disabled mimemail and enabled HTML mail  - still text


Setting HTML mail configuration under admin/config.  I set it to:

  • Use the default template
  • Use Danland (my site theme)
  • Use full HTML

RESULT : sending a test email from HTML email using HTMLmailsystem and ensuring that the mail was sent in HTML gave me an HTML result.


To get Simplenews to send a basic e-mail, you still need to set the Sitewide defalt to HTMLMailSystem.  I also added a new setting for Simplenews using simplenews as the key - I think this may mean that I can use HTMLMailSystem for some modules but not for others - but I'm not absolutely sure!


Resulting e-mail (sent as a test) : 

  • Sent the e-mail in HTML
  • Included the embedded picture
  • Included the unsubscribe facility

Using Simplenews, you modify the relevant file (htmlmail--simplenews.tpl.php) to suit your requirements (I added a blue border and a Llandudno Sports Club heading) and it should send in that format (worked for me).