Showing posts with label drupal. Show all posts
Showing posts with label drupal. Show all posts

Sunday, 29 March 2015

Drupal security updating

Using drupal it's always good to stay up-to-date with security updates. The trouble is, how to update as it is usually a manual thing (please could you automate it Drupal?).

So, the manual process is:
  1. Backup files
    1. You really only need to backup the /Sites/All folder, but I backup all of it
    2. I use FileZilla, and simply drag the whole online folder onto my machine in an appropriately named folder - /Backups/29-03-2015/webfiles/
  2. Backup database
    1. The database is probably the most important thing to backup
    2. Log in to your myPHPadmin console
    3. click on the database
    4. Click on export
    5. I just use the simple settings
    6. When it's made the file, it'll give it to you to download
    7. Download and put it in an appropriately named folder - /Backups/29-03-2015/database/
  3. Download the latest Drupal release
  4. Upload all the files
    1. I use FileZilla, which doesn't replace folders, only files within folders. Very handy! You don't want to overwrite your /sites/ folder as this contains all your custom stuff!
  5. Run the update
    1. go to http://www.yourwebsite.com/update.php
  6. Done!

Saturday, 21 February 2015

drupal views link to another view

I have a view which shows a list of a content type. When the content is clicked I want to show another view of that content.

The reason is I want to make use of the css layout I've already made with a views slideshow, and I would like to duplicate it with another view of just one item.

I have found this question, which is answered linking to these places about arguments.

I worked it out in the end. Although I did have trouble to begin with because I got all the settings correct and it still didn't work. But on creating a new view with the same settings it worked. It might have been due to the url having several 'layers' to it.

Basically:
  1. Sort out your page
  2. add 'contextual filter'
    1. I did a taxonimy term.
  3. test out in preview panel.

Saturday, 7 February 2015

Drupal views slideshow image as css style background

Thought I'd document this as I will probably do this in future developments.

I wanted a views slideshow, with the images appearing full screen with text ontop. It appears simple at first but actually required more digging.

Backstretch does not work with views slideshow, as it applies the image background to elements not within the slideshow.

I found a slightly helpful article which suggested a fix, but later found the forum from where more helpful information was taken.

to sum it up, you need views to output the url of the image for the field, and then use a views template override to get this url and 'render' it inside a html element as the background-image style.

To do this:

  1. Get views to output the url of the image
    1. in the views view, add a Relationship
      1. this needs to be a 'File Usage: file'
    2. next add a field '(file) File Path
      1. in this field, tick the box titled:
        1. Display download path instead of file storage URI
  2. Now to render this URL inside a HTML element you need a template override
    1. In views veiw, go to 'Other' > 'Theme' > 'Information'
      1. find the template override for the field
      2. create a new file with that exact name and place it in your theme
    2. inside this file paste this:
      1. <div class="mainImage" style="background-image:url('&lt;?php print $output;?&gt;');">&lt;!--<img src="&lt;?php print $output;?&gt;"style="visibility:hidden; "></img>--&gt;</div>
    3. Done
You can now style this .mainImage div as:
.mainImage {
position: fixed;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
z-index: -2000;
background: no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

sorted.

It now changes with the views slideshow.

Wednesday, 28 January 2015

Drupal Slideshow with text overlay

I have a content type which I has a main picture and some intro text and a title. I would like to 'slideshow' this full screen, with the text of each one over the top of the image, and the title at the top of the page. With thumbnails of all down the side, clickable.

I've seen this post which describes doing it with Views Slideshow, as demo'd here. I shall give it a go presently.

it involves adding a folder into the server. Look at the error when you try and enable the module.

After the install all appeared very nice and worked almost swimmingly.

Drupal restore from backup

well, I've been drupal'ed. Time to restore. thought I'd export content type and content. Here's how:

http://drupal.stackexchange.com/questions/39417/export-content-types-using-features

http://drupal.stackexchange.com/questions/20498/export-content-in-features-using-uuid-features

couldn't do the second of these tutorials as it was written in 2012 and I think things have changed.




Here's what I did to restore:


  1. Downloaded the database (for backup)
  2. downloaded all files (for backup)
  3. downloaded the new drupal
  4. uploaded all new drupal files (replacing old files)
  5. done
It was a while ago I did this so I'm not entirely sure but try this first next time.

Navigating to a viagra link came up with 'no such page'.

Sorted

Thursday, 2 October 2014

Inventory and job logging database

Over the years I have been working, I've realised a searchable database of jobs done and using which inventory items would be very useful for both large organisations, and also for individuals as well.

The important things to log are (in no particular order):
When: Time frame
Who: The person or persons involved
Where: the locations involved
What: The objects involved
How: The process that was performed (e.g. replace, fix, switch off and then on)

What the database would require are:
Time
People
Places
Objects
Processes

One other aspect of this database that would be useful is booking equipment. But this could be thought of as a process?

Time:
Start time
Predicted end time
End Time

People
Login Name
Contact Details

Places:
Geographical
Room Number

Objects:
Serial Number
Make
Model
Specifications

Processes:
Type of process


An few working examples to help design the database:

A new iMac has just been delivered to the college and is put in a computer suite:

  1. The database is logged onto with Username and Password
  2. A process is selected called: Add item to inventory
  3. User adds:
    1. Make
    2. Model
    3. Serial Number
    4. Organisation made Serial Number
    5. Specifications
    6. Room
A student would like to borrow an iPad:
  1. The database is logged onto with Username and Password
  2. A process is selected called: book out item
  3. User selects
    1. type of item:
      1. Make: Apple
      2. Model: iPad 2
    2. Time from: Today at 12:15
    3. Time until: Today at 16:00
  4. User is show whether any iPad 2's available for that time
  5. User confirms booking
  6. User sees instructions
Well, just having another look at the database and found this nice little helpful question and answer about querying a database to find 'free' items. Also describes the database very nicely using MySQL (need to learn this)

I'm thinking about making it in Access and then exporting it to MySQL? Or perhaps I should just delve straight in?



Ready made alternatives:

Here is a list of starting points for different systems:
Drupal - Merci module - this looks good!!
Drupal - Resource booking
Drupal - Resource conflict

Saturday, 20 September 2014

Drupal Backup and Migrate - how to (in progress)

So, I have a drupal website. I'd like to write down the process of backing up and then restoring upon a complete failure.

So, to backup just use the default backup and set to download. Save these somewhere safe. Just to be safe I also did the same for Public Files Directory and Private Files Directory.

I guess thats the easy part. For the next part I've found it hard to find any documentation on restoring from a complete failure. Here's what I have found:

http://www.anexusit.com/blog/how-restore-backup-migrate-file-using-drush
http://drupal.stackexchange.com/questions/40490/how-to-restore-a-site-from-a-backup-done-with-backup-and-migrate-module-using-dr

Both are related to drush which is a command line shell and scripting interface for Drupal.

My best guess for restore is to install drupal, install drush and run the restore command line.

If you also lose files, then you have to make sure you have backup of all files as well.

I think what I'd really like is the backup utility used with Joomla, Akeeba. This is much easier. I don't even think you need to install Joomla to reinstall. And it backs up all files. There must be a reason it isn't as easy. Oh well.


Sunday, 3 August 2014

Gathering images and media for use in a Drupal site

So I have hit a slight stumbling block whilst trying to integrate media from external websites into my own.

I want to collect Photos from Flickr which are linked to the project and display them on the website in the form of a gallery.

The first thing I tried was flickr module. But I was a little underwhelmed by how simple it was. It simply adds links to the specific galleries etc. that you want. The block adds thumbnails, but thats about it. Whenever you click on anything it takes you straight to flickr. Not what I wanted.

The advantage of this is that every thing can have a 'flickr' field, and so can be used on the map which I have.

I tried using with Views, but I think I need to do some more planning to get this working. But I think it won't work as any fields/data just links to the flickr site.

The next thing to try is the Media module. This is more like what I'm looking for. There is a plugin for this module specifically for Flickr

Saturday, 31 May 2014

Drupal moving database from one server to another

So I wanted to get a site I've been making 'live' which meant transferring from the test server to the real one. How to do this? I remember in Joomla it was as easy as pie, not so with Drupal, although not too tough.

Basically:

  1. move all files
  2. move all tables from database
So, in myPHPadmin you can export, but I was coming up with an error:

Error

SQL query:
--
-- Database: `sitename_pw`
--
CREATE DATABASE IF NOT EXISTS `sitename_pw` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

 
MySQL said: dot.gif
#1044 - Access denied for user 'my_user_name'@'localhost' to database 'sitename_pw'

So I found this website which explained that you have to export the tables within a database, rather then a whole database. To do this you have to be looking at the database tables, then press the export button to export just the tables.

Then when you import them, you have to be actually in the new database and press the import button

Sunday, 30 March 2014

Drupal Backup and Migrate private folder settings

So, I'm just getting started with Drupal and just installed the Backup and Migrate module. When I tried a backup to a folder on the same server it came up with an error. It was basically saying that this folder was not private and anyone can access it.

Thought I'd take a quick look into it. Turns out that the folder in question - sites/default/files/private/backup_migrate/manual/
can be read by anyone, therefore files are not safe.

So, how do you make it 'private'. Well, a good test is to try and navigate to the file:
sites/default/files/private/backup_migrate/manual/test.txt
which automatically gets made. I typed it into a browser and it loaded up. Simple.

So, to limit access depends on you hosting provider. I'm with Daily.co.uk, and they suggest using .htaccess files. I found this nice article on the subject, worth reading through properly.

I found that this command at the top of the .htaccess file (which was already in the folder) solved the problem:

AllowOverride All

I figure it's telling the Apache server to override all options.