Wednesday, March 20, 2013

Installing WAMP or XAMPP and Drupal

WAMP Installation
This post is dedicated to the new installation of a web site.  Haven't done it for a while, so most of my software (previously downloaded) is out of date.

The first step is to get your requirements.  In the old days, you would go to the customer and get some information and put together a detailed specification that the customer would then sign off on.  I prefer to speak to the customer to get an idea of what she wants and then put a basic site together so that early on in the process, she has an idea of what she is getting.  Of course one of the advantages of drupal is that this is easily changed.

Next step is to set up your offline web site.  To do this I use WAMP (Windows, Apache, MySQL and PHP).  It turns out that my version is way out of date and when I uploaded and installed the new version over the old one, it didn't work.  Major problem.  I simply removed the previous version and changed the name of the Wamp folder to wampold and started from scratch.  

Once installed, you can check two things.  going to local host in your browser and coming up with the home page proves that you have connected to the server.  Next you need to get PHPmyAdmin going.  In my case I got a '2002' error telling me that I had been rejected:

#2002 - No connection could be made because the target machine actively refused it.

While the solution could be skype (try stopping it), this is the best answer I found and the one that worked for me:

left click wampmanager icon -> Apache -> httpd.conf 
this will launch notpad to edit the Apache config file 

Look for 'Listen' and change it to 'Listen 0.0.0.0:80' 

reboot the software 

Found the answer at this site:

http://forum.wampserver.com/read.php?2,110318

So finally having got the server going, go to PHPmyadmin and open a new empty database (with the name of your new site) and set up an admin user with a password.. 

Now you download the latest version of Drupal, make directory under wamp/www with the name of you new site and unzip drupal files (not the file name) into this site.

Go to your browser and type localhost/[new site name] and follow the installation instructions.

XAMPP
XAMPP is similar to WAMP in that it is a server that you set up on a Windows machine.  I found that it was less intuitive, but more likely to work.  I tried to get WAMP working again recently and failed.

Like WAMP, you simply download it and run it.  Unlike WAMP, you have to start the various part manually.  The two that are important are Apache and MySQL.  PHP is also included but not in the control panel (which is a little irritating, but not a train smash).  Once again, in order to set it up properly, I had to change the Apache port (using the config button) to 2375 (recommended) instead of port 80.  The down side of this is that you have to go to localhost:2375 to find the main page of the server and localhost:2375/yourwebsite to get to your web site.

If you are using Drupal, there is one other trick that I only learned much later (which I couldn't edit my content types in Drupal) and this is probably applicable to WAMP as well.  

  • Open my.ini (this is the config file for MYSQL)
  • Change max_allowed_packet from 1M to at least 5M (or increase it until the irritating error (PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone) has gone away
  • When you install Drupal, first go to localhost:2375/PhpMyAdmin and add a database (name).  You log in with the password that you set up for MySql.
  • When installing Drupal, don't use the advanced tab and make settings there.
  • The easiest way is to use the same username and password above.



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).



Thursday, November 24, 2011

Agreservations

24/11
Agreservations is one of a number of reservations modules that are available to Drupal 7.  
Discovered it today and set up a site.  The first thing that is required is Ubercart (and all that goes with it).
Once duly set up, there are a few modules that you need to go with agreservations.  These include:
Internationalization  - not that easy to find as in agreservations, the missing file is ' i18n ' ???  Search in Drupal still doesn't show it up, but there it is.
References - much easier although a little confusing as there are a number of variations that are required.
Calendar - Thought this may not be needed - or worse would cause a conflict as in the admins blog he (or she) indicates that there is a fork and that its no longer required.
Variable - Easy to find and install.
Went ahead with the installation.  Seems to have gone OK.
So how does it work?  There are a number of new content types, but no new admin menu items (as with UC hotel and Rooms).  Will now wait to download the very large installation video.

25/11
Suggestion made by on the agreservations installation video page was to modify the php settings found in the sites/default directory to allow for longer timeout times.  I think this is a good idea as a standard as it avoids that horrible 'fatal error' when you're trying to activate a module.
The initial setup of agreservations is proving more difficult than anticipated - I got that dreaded fatal error when I tried to look at the and I now have a strange PDO:construct error.
This may be because I did not follow the instructions regarding the order of installing modules (not sure how this would effect things) or it may be because there is some stuff that I have not set up.  It does mean that one needs to be fairly careful in the initial installation.
...just had a major problem (not sure why) - when I installed yesterday, I copied some stuff off another localhost site and  I now seem to have a lot of that content - there must be some strange link or other.  time to restart the process from scratch using a clean installation with clean modules!

From Scratch:
Install Drupal 7.9
Install Ubercart needs:


Recommended:

Problems with installation - fatal error related to ctools when installing ubercart.  Total re-install but this time instead of copying Ctools and views and activating, installed them both individually.


Following directions  installed agreservations.  Note - had forgotten to change the settings file.  Changing it now caused errors. (wonder if these are related to my previous problems!)


Setting up the installation:
Set up store information under store configuration (especially currency)
UNDER ADD CONTENT : 
First create a category type
Then create a timeframe
Then create a rate type
Then create a unit type
From the video he then does something a little mysterious:  He goes to the store - classes and deletes agreservations_unittype, and then generates it again using the same name for Class ID and Class Name = unit type.  Net result is a number of errors, but after that when you re-edit your unit type and add prices.
Once done, one can create a couple of rooms.
Then went to calendar
Fatal error: Class 'calendar_plugin_row_node' not found in C:\wamp\www\agreservations\sites\all\modules\agreservations\agres_views\includes\agres_views_plugin_row_node.inc on line 24
Oh no!!  Don't have a simple solution to this one. Raised a bug report.
Andreas came back very quickly with couple of suggestions:
Tried re-installing calendar, no joy.
Sent him the sql file and a list of modules.  Hold thumbs!
28/11


Turned out that my version of the Calendar module was too old.  Updated this to Version.
Fatal error went away, but now there is a new one:
Notice: Undefined index: access in agres_views_menu_local_tasks_alter() (line 713 ofC:\wamp\www\agres\sites\all\modules\agreservations\agres_views\agres_views.module).
Must admit to losing a bit of confidence at this stage - but Andreas is still talking to me.  


29/11
Wants me to check that all of the other modules are up to date.  It appears that asking Drupal to do this is haphazard so I will do it manually!:


Internationalization : must have been updated since I visited there a few days ago! Version 7.x-1.2
Views 7.x-3.0-rc3  Up to date
Ubercart 7.x-3.0-rc2 Up to date
Rules 7.x-2.0 up to date
Variable 7.x -1.1 up to date
Entitiy 7.x-1.0-rc1 up to date
Token 7.x-1.0-beta 7 up to date
colorbox 7.x-1.2 up to date
references 7.x-2.0-beta3 up to date
date 7.x-2.0-alpha4 up to date
calendar 7.x-3.0-dev up to date
Ctools 7.x-1.0-rc1 up to date
agreservations 7.x-1.0-alpha2 up to date


Turns out that there is an even more update version of Date - Alpha5.  Installed this and the error messages went away.  Now I can see the calendars for Week and year.  There is still a problem with Month and a template error in Day.  But I do get the feeling that we are getting there.


Thanks for all the support from Andreas, hopefully we can get this working.


30/11
The plan is ultimately to put together a site that will allow me to let a number of accommodation providers advertise.  From what I have seen in the last few days, I should hopefully be able to do this by making modifications to views to enable it to only display the calendar of a specific provider and to allow the public to only book this premises when they go to that page, but also to allow the user to have a 'trolley' of accommodation that they have chosen.


1/12


Great news - Alpha 5 seems to be the solution to more than one problem.  There is an Alpha5 version of Agreservations.  


Installed and finally the calendar is visible in all windows.  Next plan is to go through his more detailed installation videos to make sure I am clear on how the software works.
3/12
There is nothing quite like sleeping on a problem!  Now that the calendar is working, I have been unable to add a room to the cart even though when I add the room, it shows as booked on the calendar.  There is a description in one of Andreas's videos that tells you how to set up room rates, and this is where the solution eventually lay.  Here is the bug report that I submitted on the subject.


The error that you get is 

<Price Rate> is not a product Unable to add to cart

"This is and issue that I think you may be aware of but is useful to mention for others trying to resolve problems.


When setting up rates in agreservations, it is important the the ubercart product information is shown on the setup form. If it is not, it means that agres_rate has not been setup in the ubercart classes.
This problem shows itself when adding a room to the cart. You get an error saying that " is not a product Unable to add to cart"
There is a simple solution to this - go to store - products - manage classes. If agres_rate is not there (which is was not for both my clean and my previous installations), then it needs to be added:
ClassID : agres_rate
Class nam: agres_rate
description : agres_rate
After this, there should be the ubercart information under the price rates.