Hacking pMachine: Displaying post IDs

Posted by Pierre Igot in: Blogging
May 8th, 2004 • 5:11 am

While I still know pretty much nothing about PHP and MySQL, I am trying to find ways to customize pMachine, especially now that pMachine’s makers seem to be focusing their energies on their new Expression Engine product.

One particular thing that has been frustrating me for a long time is that I regularly need to refer to the post ID of an entry in my Betalogue blog, i.e. the unique number that identifies the post and is used in a number of ways in the URLs for accessing specific pages, etc.

Now I have just found how to “hack” the pMachine server files used for the pMachine control panel so that the post ID is displayed along with the post title when I need it.

The hack is pretty simple. The file to modify is pm/cp/weblog.cp.php.

Adding <?php echo "$post_id"; ?>  after <td bgcolor="#<?php echo "$altcolor"; ?>"><div class="smlink"> in line 3152 will add the post ID number before the post title in all pages in the control panel where a list of blog entries is displayed in table form (in the “Edit Your Entries” page, in the search result pages, etc.).

And adding <?php echo "$post_id"; ?><br> after <div class="text11"> in line 2128 of the same file will add the post ID number before the post title in all pages in the control panel where the full text of a post is displayed (in the preview pages, when viewing a search result, etc.).

Quite handy as far as I am concerned! I wish I had done it much sooner…

(I did this using BBEdit, which lets you display line numbers and also uses colour highlighting for the PHP code, making it much easier on the eyes.)


2 Responses to “Hacking pMachine: Displaying post IDs”

  1. Arnaud Leene says:

    Just curious: what do you use the post ID for? Is the Permalink not enough?

  2. Pierre Igot says:

    I use the ID for several things. The main one is cross-referencing. Whenever I want to refer to an existing post, I search for it using a few key words, I look at the list of results, see the ID of the post that I want to refer to, and then I insert a glossary entry in BBEdit (I edit my posts in BBEdit before posting them) that is a HREF link with the full URL and XXX where the ID is supposed to go. Previously, I had to hover over the post title in the list of search results to see the post ID in the URL displayed in the status bar at the bottom of the browser window. Now I just have to look at the post title, the ID is right there. Saves me a few mouse movements.

    The other use is for editing/deleting existing posts. If I see a typo in a blog entry, I just use a Spell Catcher X glossary abbreviation

    pmedit =>
    [mypath]/index.php?sx=&m=weblog&p=edit&id=

    in Safari’s address bar and type the ID at the end of that and press Return, I am taken to that blog entry in editable form. Again, saves a few mouse clicks.

Leave a Reply

Comments are closed.