Posts Tagged PHP

Include latest article list on non WordPress website

Recently, we needed to develop a website that used a blogging system – but didn’t¬†necessarily¬†want to use the blog to power the full website as we had other plans for that.

In a nutshell all we really needed was to be able to include a top 10 latest articles list from our WordPress blog on the home and left handside of every page.

In the past, we probably would have used a RSS feed parser to include the latest list, but this was never very clean for us. After much searching on the web we eventually came up with a combined solution and here it is forever embedded on my blog so we don’t have to search the next time round:

<?php
      require('pathto/blog/wp-blog-header.php'); // change this to fit your path
      query_posts('showposts=10');
?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

<?php endwhile; ?>

Tags: , , , , , ,

No Comments

Typo3 : Typo3temp folder full of js files


A common problem with anyone using Typo3 4.2 and GMENU Layers is that Typo3 creates a temporary js file each time a page is loaded. This ends up leading to your typo3temp folder being filled with thousands of js files. In some cases, with busy websites, we’ve seen the Typo3temp folder filled with as much as 1-2GBs of temporary js files. Clearly a problem, but not such as easy one to fix.

If you, for some reason are still running the 4.2 version of Typo3 here’s how you fix the issue.

The first thing you need to do is delete all those temporary js files from the typo3temp folder. This might be a bit of a nightmare if there are hundreds and thousands of files. In one case I needed to resort to removing the files via ssh using a wildcard and file name from within the typo3temp folder, e.g. rm -f javascript_12* (be very careful using the rm cmd MAKE SURE YOU ARE IN THE TYPO3TEMP FOLDER – no warranty provided by me if you mess up!).

Once that’s done and you’ve taken a complete backup of your website, complete the following steps:

1. Download patch file from http://bugs.typo3.org/view.php?id=12376
2. Upload the patch file to the root of your Typo3 installation (e.g. the directory with index.php and Typo3 folder etc)
3. Log into your SSH account and cd to the root folder
4. Type patch -p0 -i nameofpatchfile.diff
5. Log into FTP and delete all temporary js files from the typo3temp folder

You should now log on to your website and click around a few pages. Then check your Typo3Temp folder again through FTP to see if any js files have been created. You should really only see one (unless you have multiple navigations).

That’s it!

Tags: , , , , , , ,

No Comments

Backend Layout (Grid View) Feature of the New Typo3 4.5 LTS

For anyone who has ever used Typo3 as a CMS, they would be well aware of the limitations associated with the layout of a page (backend layout) in the administration area.

Without hacking or using third party extensions such as TemplaVoila, it was pretty difficult to get anything more than the Left, Normal, Right & Border columns to add content elements to your website. For someone familiar with Typo3, it wasn’t a major problem, but as soon as you put the administration system in front of someone who was about to use it for the first time, it created nothing but confusion.

With the release of Typo3 4.5, Typo3 developers now have the ability to make a more user friendly admin page for content editors through their new core feature Grid View (Backend Layout).

With ease, we can now give the Typo3 user a more user friendly and intuitive admin page just by creating a few simple backend layout views that only helps people make a better association with the websites design.

I found it very hard to find any decent information online about how to implement the Backend Layout feature, so I’ve decided to put together this little tutorial on how you can get started.

Step 1 : Create Backend Layout
The first thing you need to do is create a system folder to store your backend layout templates.

Once you’ve created the new system folder, choose List (on LHS) > the System Folder > Click the “Create Record” button at the top of the RHS page. Then from there, you should choose “Backend Layout”.

On the next screen that loads, enter your Title (used to easily identify the layout) and click the Grid Wizard icon (pencil and notepad) beside the Config field. It is also a good idea to associate a simple graphical icon to help you identify the layout visually.

 

The Grid Wizard allows you to design a layout, in our simple example we use a Top Left, Top Right and Bottom style layout.

 

One thing to note here is that you MUST enter a Name and Column number for each column of the layout grid. If you don’t do this, you will get a “not assigned” error in the admin page.

The Grid View wizard creates the config code required to make it all work!

E.g.

backend_layout {
colCount = 2
rowCount = 2
rows {
1 {
columns {
1 {
name = TopLeft
colPos = 1
}
2 {
name = TopRight
colPos = 2
}
}
}
2 {
columns {
1 {
name = Bottom
colspan = 2
colPos = 3
}
}
}
}
}

Once you are happy with your layout, you can now begin to apply the layout to the backend page.

 

Step 2 : Apply Layout to Backend Page
This step is very simple, all you need to do is access the page properties of the page you would like the Backend Layout applied to. Choose the “Options” tab and at the bottom of this page, you should see the icons (if you’ve applied one to the layout) of the layout options you have available. If not, you can simply choose your layout from the drop down menu.

 

Step 3 : Apply to Front End Template
Nothing hugely changes much from a front end perspective. We all have our own ways of doing this I’m sure. But here’s a simple example of what we would do:

Layout.html File

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>

<html>
<head>
<title>Untitled</title>
</head>

<body>

<!– ###DOCUMENT_BODY### –>
<div id=”topLeft”>
<!– ###TOPLEFT### –>
TOPLEFT of page
<!– ###TOPLEFT### –>
</div>
<div id=”topRight”>
<!– ###TOPRIGHT### –>
TOPRIGHT of page
<!– ###TOPRIGHT### –>
</div>

<div id=”bottom”>
<!– ###BOTTOM### –>
BOTTOM of page
<!– ###BOTTOM### –>
</div>

<!– ###DOCUMENT_BODY### –>

</body>
</html>

 

TypoScript Set Up
page = PAGE
page.typeNum = 0

page.10 = TEMPLATE
page.10.template = FILE
page.10.template.file = fileadmin/layout.html

page.10 {
workOnSubpart = DOCUMENT_BODY
subparts.TOPLEFT< styles.content.get
subparts.TOPLEFT.select.where = colPos = 1

subparts.TOPRIGHT< styles.content.get
subparts.TOPRIGHT.select.where = colPos = 2

subparts.BOTTOM < styles.content.get
subparts.BOTTOM.select.where = colPos = 3

}

One final thing to do is make sure that you have included the CSS Styled Content in your statics!

That should be enough to get you started with this great new feature! Enjoy!!

Tags: , , , , , , , ,

9 Comments

WampServer 2.0i – Windows Vista, Apache, PHP & MySQL

WAMPSERVER 2.0iI recently had to set up a web development environment on my Windows Vista machine to test a web site we are currently working on. Although I have wrote in the past about how easy it is to install PHP 5 with IIS on Windows Vista, it just didn’t run that smoothly for me this time around. Regardless of what I did, I just couldn’t get it up and running (without spending hours) on my machine. I even tried to get Apache running instead of IIS, but again it was just taking way to long. No matter what I did I just couldn’t get PHP running in conjunction with Apache or IIS. No doubt it was some sort of permissions error, but I didn’t waste my time looking for the exact issue.

No, instead I ran a Google search to find a “WAMP” installation tool. The first one I found was WampServer 2.0i and I was instantly impressed. Not only was it a painless install that took less than a minute, it installed everything I needed. With one installation, I had Apache, PHP and MySQL all running smoothly on my Windows Vista machine.

Even better still, it also gave me the ability to install multiple versions of critical services such as PHP, MySQL and even Apache. This is a web developers dream, it means that you no longer have to downgrade you working version in order to work on an old site built on say an old version of PHP. There are many other excellent features, as well as many extensions to the product freely available for download.

If you’re having trouble getting a web development environment working on your Windows Vista (or others) – I suggest you download this before wasting your time going the manual route!

DOWNLOAD HERE : http://www.wampserver.com/en/

Tags: , , , ,

No Comments

When Typo3 4.2.1 Install Tool is blank

TYPO3

While installing the latest version of Typo3 4.2.1 on a new server, we encountered a strange issue.

For some odd reason the Install page was blank. After much searching we found that it was in fact because of the php memory limit. Luckily we were able to change this in the .htaccess file by simply adding the following line to it:

php_value memory_limit 32M

Typo3 needs 32MB of memory to run.

I hope this helps some frustrated Typo3 developers who have had the same issue!

Tags: ,

2 Comments