Search

Phrase

Display

 

Category

   

Order

 

Pagesize

Results

If the result list is too large, please consider these hints

  • Reduce the number of websites.
  • Add more keywords.
  • Use quotes for building terms from keywords. For example, the phrase banner image searches for all articles containing both words. However, "banner image" searches for the exact two-word phrase.
378 hits12345678910

1. Keeping Navigation Current With PHP

A List Apart, Tutorials, 15 KB, 1205 words

Turning unordered lists into elegant navigational menus has become the new favorite pastime for many web developers. Adding a unique id or class attribute to indicate which menu item reflects a user's current page, however, can become laborious. Even if you use body id attributes instead, as ALA does, some labor is involved and it is easy to make mistakes. But thanks to PHP, we can add these current-page indicators automatically.

Consider this tutorial a marriage of Christopher Robbins's Manage Your Content With PHP and Mark Newhouse's CSS Design: Taming Lists. The offspring of this marriage will be a single navigational document called navigation.php. Using PHP, we will include our one-size-fits-all navigational menu into every page of our site. Unlike other site-wide includes, however, this one will know which page the user is viewing and will adjust the current-page indicator appropriately....

continue reading ...

2. HTML or PHP?

Learning Movable Type, Tutorials, 21 KB, 1256 words

When you are first setting up a new weblog, Movable Type prompts you to choose a file extension in the weblog config preferences section. The default setting is HTML.

If your server allows PHP scripts, and you would like to add customization features that aren't part of the default Movable Type system, it is highly recommended that you choose PHP as your default file extension preference in place of HTML. Doing so allows you to take advantage of many freely available PHP scripts to help customize your weblog. PHP is an open source scripting language that is powerful, stable, and extremely popular for adding dynamic elements to websites. In your Movable Type weblog, PHP scripts can...

continue reading ...

3. Using PHP and MT Includes

Learning Movable Type, Tutorials, 25 KB, 1375 words

Using includes, you can modularize your template code making it easier to edit and rebuild your Movable Type templates. For example, instead of having all of your side bar and center content on the same Index template, you can set up a separate file to hold your side bar content and use an include to "include" it on your index template. This is especially handy if you use the same sidebar content on multiple index and archive templates.

There are two basic ways to use includes in Movable Type - the MTInclude tag and PHP includes. MTInclude is easy and anyone using MT can use it. The downside (slight) is that if you make a change to an include file, your sidebar for example, you have...

continue reading ...

4. PHP Dynamic Publishing: Developing Plugins

Six Apart Pronet Articles, Tutorials, 36 KB, 2180 words

Note: This tutorial was first published on October 29th for members of the Professional Network. If you'd like to get access to the benefits of membership in the network, sign up now.

Our last tutorial covering dynamic publishing provided a high-level technical overview of its implementation. In this tutorial, we will examine the way you create plugins for the PHP dynamic publishing model. It varies a bit from the Perl model, since we have built the template processing on top of Smarty, a popular and powerful templating engine for PHP.

Use the Source, Luke!

To get you started, there are a whole host of MT tags that have been ported from Perl to PHP. These would be the core...

continue reading ...

5. Querying a MySQL database with PHP - Random Quotes

Learning Movable Type, Tutorials, 36 KB, 2815 words

Updated. Originally posted April 3, 2005.

If you are using a MySQL database and your blog is PHP enabled (see Converting to PHP), you can use PHP scripts to pull blog data from your database to add customizations to your blog. For example, say you would like to have on your sidebar a quote, randomly pulled from a selection of quotes, with a new quote displayed every time you refresh the page. You can accomplish this by creating a separate weblog for quotes, then using a simple PHP script to pull the data from your MySQL database, and using a PHP include to put the script results into your main weblog page.

PHP scripts are a level of difficulty up from Movable Type, and require...

continue reading ...

6. Manage Your Content With PHP

A List Apart, Tutorials, 25 KB, 3042 words

In this article, we'll build a simple, template-driven site that separates style, content, and structure in your website. We'll create a cross-browser stylesheet switcher that remembers the user's preferences, touching on php variables, cookies, if statements, and including pages with require_once.

Separating style, content, and structure

The separation of style from content has become the bugbear of the HTML developer. Traditionally, we've used well-written CSS and XHTML to achieve this separation, and we've seen how much easier it is to update our sites or provide multiple styles when we write our markup this way. By adding some...

continue reading ...

7. Dynamic Publishing: PHP Architecture Overview

Six Apart Pronet Articles, Tutorials, 30 KB, 2385 words

This is the first in a series of tutorials regarding the API for developing Movable Type plugins for the new PHP dynamic rendering engine.

This tutorial applies to the current release of MT, which is version 3.11. Subsequent 3.x releases should also be compatible (and releases beyond that, but I cannot say for sure).

PHP Dynamic Publishing Architecture

The first thing we should cover is the architecture behind it all. In terms of PHP scripts, the following shows the order of invocation from request to response. • HTTP request • .htaccess rule / error document • mtview.php • MT Class (MT.php) • MTViewer Class, aka Smarty (MTViewer.php) • PHP • HTTP response with output

Let's examine each stage of...

continue reading ...

8. Converting to PHP

Learning Movable Type, Tutorials, 34 KB, 2704 words

This tutorial is written by LMT guest author Sarah Hughes of This Chick (aka Maddy in the MT Forums).

Many customizations for Movable Type call for using PHP scripts that require that your pages have a .php extension rather than a .html or .htm extension.

PHP is a server-side scripting language which involves a) the server looking at your pages for a PHP script, b) running the script, and c) outputting the results to the page. This is called "parsing". In order to successfully use PHP in your pages, you need to ensure that your account on your webserver is set up to parse your pages for PHP scripts. This feature is pretty standard these days, but check with your webhost before...

continue reading ...

9. PHP, CGI, and MT: Together at Last

MezzoBlue, Tutorials, 17 KB, 1470 words

A long-standing problem with Movable Type's templating system is that the Perl-based .cgi files it relies on don't allow for the use of PHP. That's changing though.

The lovely and talented Shaun Inman wrote up his method of using PHP includes to pull in CGI data back in January, which allowed him to pass a query string to the script using HTTP GET. Technical details are at Shaun's, go read and come back when you're done.

Using his thinking as a starting point, I spent some time a few weeks back tweaking to solve another Movable Type problem - the comment preview pages that are so often the neglected children of sites like, say, this one.

The problem is that I use PHP...

continue reading ...

10. PHP Dynamic Publishing: Architecture Overview

Six Apart ProNet Weblog, News, 38 KB, 2484 words

This is the first in a series of tutorials regarding the API for developing Movable Type plugins for the new PHP dynamic rendering engine.

This tutorial applies to the current release of MT, which is version 3.11. Subsequent 3.x releases should also be compatible (and releases beyond that, but I cannot say for sure).

PHP Dynamic Publishing Architecture

The first thing we should cover is the architecture behind it all. In terms of PHP scripts, the following shows the order of invocation from request to response. • HTTP request • .htaccess rule / error document • mtview.php • MT Class (MT.php) • MTViewer Class, aka Smarty (MTViewer.php) • PHP • HTTP response with output

Let's examine each stage of...

continue reading ...

11. Random Entries Using PHP

Learning Movable Type, Tutorials, 39 KB, 3186 words

There are two methods to create a random entry, pulled from your weblog database (if you aren't using dynamic publishing). The easiest is David Raynes' MTRandomEntries plugin. However, MTRandomEntries generates a random entry only when you rebuild the page on which the MTRandomEntry code is located. If you want a random entry to be generated each time the page is refreshed in a browser, you can do that with a PHP script that pulls the data from your MySQL database. For this method to work your blog needs to be PHP enabled and you need to be using a MySQL database.

This tutorial will outline variations of a PHP script you can use to generate random entries, similar to what can be seen...

continue reading ...

12. Using PHP Code In Templates

Six Apart Knowledgebase, Manuals, 29 KB, 675 words

Question

Can I use PHP code in my templates?

Answer

Movable Type templates generate standard HTML pages; so any coding language which can be used in a standard web page can also be included in your templates.

Here are some important tips to remember about using PHP in your templates:

No shortcut tags in dynamic templates

If you are using PHP in a dynamic template, you should not use the "shortcut" opening tag: <?

Instead, you should use the full version: <?php

Template Tags are processed differently in static templates than...

continue reading ...

13. Build a PHP Switcher

A List Apart, Tutorials, 10 KB, 882 words

For your style-sheet-switching pleasure, A List Apart offers the Switcher, a piece of JavaScript that dynamically changes page styles. Functional as it is, it quite unfortunately relies on the user to have both JavaScript and cookies enabled. There's not much we can do about the cookies, but we can sidestep client-side processing with a little help from PHP.

PHP is a scripting language available on many, many servers. It's fast, it's free, it's open source and it handles everything on the server side, so there's no need to worry about users who have disabled client-side scripting in their browsers. If you're not sure if your host...

continue reading ...

14. ASP to PHP, with MT to Boot!

MezzoBlue, Tutorials, 17 KB, 1765 words

Step right up, step this way. Ladies and gentlemen, I give to you the amazing journey from one server-side technology to another. You'll be amazed, you'll be awed, you'll laugh, you'll cry. You'll… okay, so my writing style needs to calm down a touch.

I've been working on this on and off for months now, and I meant to have it up far earlier than this. Some of the final details are fuzzy at this point, but the bulk of it is on target.

This is the process I went through when upgrading my Movable-Type powered site from IIS (and ASP) to Apache (and PHP), from start to finish. For the benefit of Google, and you the reader, I'll try to spare...

continue reading ...

15. PHP Dirification

Movalog, Tutorials, 25 KB, 520 words

As I mentioned before, I ported a few plugins I was using to the dynamic system. The first of the plugins I ported was for dashify my urls (replaces the spaces with dashes rather than underscores like in dirify).

I mainly use the very simple Dashify plugin to dashify my titles so here's a php port - modifier.dashify.php however for those of you that prefer to use the more powerful DirifyPlus I've made a php port for it too - modifier.dirifyplus.php.

To ensure that the files are formatted correctly I recommend you right click the links and click save as. Upload them to your php/plugins/ directory to enable them.

Syntaxing remains the same e.g. <MTEntryTitle dashify="1"> or...

continue reading ...

16. php includes in dynamic archive templates

geekmum {movable cafe}, Tutorials, 17 KB, 315 words

I was having a heck of a time calling includes into dynamic archive pages (php files, no extensions). The syntax I used in my Main Index template was NOT working in my dynamic archives. What I found out was that I was using a php shortcut syntax which is not enabled on all servers (and perhaps in my case not in all cases? not sure about that yet - I'll look into an .htaccess solution although I have no reason to believe there is one - just a gut instinct to try)

These worked in the main index, but not in archives:

<? include "http://domain.com/tagline/rotator.php"; ?>

or

<? include "tagline/rotator.php"; ?>

This syntax works in both index AND archives:

<?php include...

continue reading ...

17. Verification Image with PHP

Don't Back Down, Tutorials, 11 KB, 752 words

I'm sure you've seen those images that display a changing value in them, something that you have to read and then type into a field so that you verify that you're human (the assumption being that a machine couldn't read the image to extract the text). They're everywhere.

Do you need one? That's a question I can't answer for you. But I can tell you how to create the image. I am working on another bit to tell you how to actually use the image for verification, but since I can't quite get it working myself, I'm going to leave that part out. This just shows you how to create the image itself.

First and foremost, you need PHP. Without it, you can't use these instructions. That isn't to...

continue reading ...

18. Convert your site from .html to .php

PubHacks, Tutorials, 6 KB, 284 words

Refer to: This Support Forum Entry. About halfway down the page, kadyellebee posted a nice little changeover guide. I followed it, and it worked perfectly. (Of course, my host has php enabled or whatever. I don't know about you.) And here it is reprinted:

Changing over to PHP:

1. make sure your host allows PHP

2. Go into the Blog Config under Preferences. Scroll down to File extension for archive files and type php (no . before) in the box.

3. Go into the Blog Config under Archiving and make sure that if you have any Archive Filenames set, you change the extension of them to .php.

4. On the Template screen, you'll want to get into your Main Index Template and Master Archive...

continue reading ...

19. PHP PreviousNextInCategory

Movalog, Tutorials, 26 KB, 506 words

I really liked Phil Rignalda's PreviousNextInCategory that would basically show the Previous/Next entries in the same category as the current entry (kinda like <MTEntryPrevious> and <MTEntryNext>)

Unfortunately this plugin didn't work under the dynamic publishing system. So announcing PHP PreviousNextInCategory. There are two files in the zip file that will need to be uploaded to the php/plugins/ directory. The two files will provide the container tags <MTEntryPreviousInCategory> and <MTEntryNextInCategory> exactly like the perl version and are to be used in exactly the same way eg

<MTEntryPreviousInCategory> <a href="<$MTEntryPermalink$>">&laquo; <$MTEntryTitle$><...

continue reading ...

20. Now Some PHP

Don't Back Down, Tutorials, 8 KB, 375 words

My buttons were in a Movable Type module, which was great because it meant that I didn't need to change every page when the buttons changed.

I did this by creating a new module (scroll all the way to the bottom of your MT "templates" page) called, appropriately enough, buttons. Then I just added a bit of code to each of the other templates where I wanted to see the buttons in question:

<$MTInclude module="Buttons"$>

Pretty easy. However, it also meant that I had to recompile every page attached whenever I changed the buttons - for instance, for a new version number or adding a new feed to the list. When I had a couple of entries, it was nothing - but then that time started...

continue reading ...

Comments

You want to post some comment? Please use the announcement post on the Movable Type Weblog.

If you want to give some feedback concerning a specific query, please use the feedback button that is shown after a search has completed.

mgs | September 27th 2005