- Published:
- September 6, 2011 – 9:59 am
- Author:
- By Dave
Doing some integration work with WHMCS, I found the need to export some of the announcements into Wordpress. Since there isn’t any native implementation of this, I found the best way is to export it directly from the database. The PHP code to do this is fairly easy…
Categories: Code Samples,PHP
Tagged: PHP, sample code, templates, whmcs, wordpress
- Published:
- December 21, 2010 – 9:49 am
- Author:
- By Dave
According to “official” system administrator rules and guidelines you shouldn’t be adding so-called vain scripts to the login prompt – only utilities that will add something useful to the system (for example, current system load, memory and disk usage, etc). However I have some systems that I frequently connect to and thought it would be neat to add a random quote script to my bash login. That being said, this should only be done on ‘non-production’ systems and adds a security vector so please be careful where you use this. The goal of this is to add a little quote, at random, every time you log into your system. My thoughts were to do it not only as a little source of inspiration but also to add perspective to what I’m doing sitting in front of the computer all of the time. Originally I was going to try to write….
Categories: Code Samples,Linux,PHP,Shell
Tagged: bash, PHP, quotes
- Published:
- August 16, 2010 – 8:34 am
- Author:
- By Dave
A forum that I am an adminstrator for has been clamoring for an iPhone theme (style) for a long time now. In the past, I hadn’t seen any usable iPhone template for phpBB3, until now.
View this entire post to view my modifications to a theme switcher for mobile devices, so that the end user can disable a mobile theme for their login if they should choose to do so.
Categories: Code Samples,PHP,Software
Tagged: iphone, PHP, phpbb, theme
- Published:
- September 27, 2008 – 1:19 am
- Author:
- By Dave
Adding a module position in a Joomla 1.5 template is not as easy as it was in the 1.0 templates. It is a two step process: 1. Add code to template PHP file. For example, this would go in the index.php file in the template folder – or if you are adding it in an include file. 12345<?php if ($this->countModules(‘user6′)) : ?> <div> <jdoc:include type="modules" name="user6" style="xhtml" /> </div> <?php endif; ?> 2. Add module name to templateDetails.xml You then need to tell Joomla which module positions are available in this template. If you don’t do this step, then Joomla will not present the module position when giving you the option of where to place a module. templateDetails.xml is in XML format. Within the 1<install> namespace, add this: 123<positions> <position>user6</position> </positions> If you already have positions listed, just add….
Categories: Code Samples,Configurations,Joomla,PHP
Tagged: design, HTML, Joomla, templates, XML
- Published:
- September 15, 2008 – 10:38 pm
- Author:
- By Dave
I couldn’t readily find an answer to this question via the google. So here it is: If you want to insert a ‘last updated’ or ‘last modified’ date on your wordpress page, then there is a simple bit of PHP code you can use for this: 1<?php the_modified_time(‘F jS, Y’);?> And via Ardamis’s Blog, there is a great way to only display this information if it has been modified after the original post date. This is a good way to let people know if there have been updates since the original post: 12345678<?php $u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_modified_time >= $u_time + 86400) { echo "and last modified on "; the_modified_time(‘F jS, Y’); echo " at "; the_modified_time(); echo ", "; } ?> This will display the last modified date and time if it is more than 86400 seconds after the creation date – that is 24 hours.
Categories: Code Samples,PHP,Software
Tagged: code, templates, wordpress
- Published:
- August 26, 2008 – 1:32 pm
- Author:
- By Dave
Drupal’s administration login area is not secure by default. Usually there is an option in the configuration area of content management systems to set a secure area for logins, otherwise your username and password are sent in plain text over the internet. Luckily, there is a module which enforces secure login on a Drupal install. Drupal Module: Securepages Although it is still in development, the 6.x-1.x-dev version worked great with my Drupal 6.4 installation.
Categories: Configurations,Drupal,PHP,Security
Tagged: Drupal, modules, secure