Using Syntax Highligher Evolved with MarsEdit
The instructions are here: http://basilsalad.com/how-to/syntax-highlighting-marsedit-wordpress/
The instructions are here: http://basilsalad.com/how-to/syntax-highlighting-marsedit-wordpress/
Categories: PHP/MySQL Tutorials Tags:
Categories: PHP/MySQL Tutorials Tags:
I disabled the “Be Sociable, Share!” plugin because it appears to be the source of the garbage showing up in the WordPress post content. The plugin pulls images from various sites and I’m guessing that it’s pulling something from a compromised site. Ouch.
Categories: Web Site Security Tags:
In this section we look at my cache mechanism. It’s similar in principle to the WordPress “transient” concept. For example, the “top sellers in the last 30 days” does not need to be calculated every page load. Calculating once per hour should be more than sufficient. Doing both calculations (all time best sellers and best sellers last 30 days) takes 1-4 seconds depending on server load, and the Top Sellers page turns out to be one of the most popular pages. It is therefore a good candidate for caching.
I also found that a lot of the border/navigation items take a long time to generate, and again are good candidates for caching. Within SunShop we make all sorts of lists for navigation purposes, every page load, and then never use much of the result. With caching, I reduced the hundreds of queries per page load down to a dozen or so.
For example, if it takes a hundred queries to build up a sorted list, and we can safely cache the result for an hour or so, we have a huge page-performance gain. Why so many queries? In certain cases, SunShop does one query to get a sorted list of item IDs, and then loops through the list doing a separate query for each item in the list.
We’ll use the Top Sellers plugin as our use case. We cache the result of each top sellers calculation for 60 minutes. Read more…
Categories: PHP/MySQL Tutorials Tags:
In this section we look at my Top Sellers plugin. This gives us a concrete example of writing a plugin. However, with this example we’ll use my full plugin “framework” which includes my Registered Object mechanism. We’ll also see my persistent-cache mechanism in use, which we’ll then explore in a later post.
We invoke the two plugins as follows, in the Top Sellers page template. We use “bb_” as the prefix to avoid namespace collisions: Read more…
Categories: PHP/MySQL Tutorials Tags:
Here in Part 4 I show another technique which I use to keep my custom code off to the side. I’m no longer a fan of the Singleton Design Pattern because of its difficulty in unit testing. However, it’s a good tool for SunShop modifications.
Our Top Sellers page has two tabs, one tab for All time top selling products, and another tab for top sellers over the past 30 days. I use “bb_” as my prefix to ensure no namespace collisions. Here is the page template: Read more…
Categories: PHP/MySQL Tutorials Tags:
In this section we look at one of my custom SunShop pages, the SEO list. I’m assuming you have access to a SunShop admin area, and you know what an admin page looks like. Visit the SunShop Official Demo Page here to follow along if you need to.
As part of our SEO (Search Engine Optimization) work, we are examining all product descriptions, short descriptions, meta descriptions, sample text, etc. I wrote code for the Edit Product page which creates a product preview, a Google-listing simulation, etc., with the target search terms highlighted.
In order to highlight the search terms, naturally, we need to know the list of target search terms. This quick-and-simple admin page allows us to enter each search term, its relative priority (1, 2, 3, etc.) on our list, and a CSS class defining the highlight color. You will recall our page support looks like this: Read more…
Categories: PHP/MySQL Tutorials Tags:
In Part 2 I explain how to get the code modifications off to the side. We start by explaining why this is important.
SunShop is actively supported software under active development. That means your SunShop installation could, at some point, be upgraded to a new software release. That generally means you lose your custom modifications – unless they are completely separate from the mainline code.
The SunShop installation instructions explain how to do this with the template/css/javascript files: Copy your preferred theme templates to a new folder and do your template modifications in the new folder. This way, when the software is upgraded and the standard template folder is replaced, your template files will not be overwritten.
Since this “SunShop Modifications” series is aimed at PHP developers, not tweaking templates, that’s all I have to say about managing the template files!
My general strategy for the SunShop Admin Area is to create a new admin page. This doesn’t always work, for example, I added some additional fields to the Edit Product page. The best I could do in this case is add my name and date as a comment, so that I can search on my own name when it comes time to upgrade the software.
My custom admin page support looks like this: Read more…
Categories: PHP/MySQL Tutorials Tags:
The SunShop software is a commercial product from Turnkey Web Tools. These tutorials do NOT expose any original SunShop code, only my own code.
My client commissioned me to make custom cart modifications to SunShop. I am sharing source code with my client’s permission. The modifications include:
Categories: PHP/MySQL Tutorials Tags:
I have a situation where I’m able to download a CPAN module distribution, but I’m behind a firewall and I therefore can’t install the module using the cpan installer. The recommended offline solution is to use the CPAN Mini Mirror. But that presents the same problem: It expects to have Internet access.
The solution is simple – don’t use the CPAN installer! Just do the Makefile yourself. Here is how I installed the Test::Class module:
tar xzf Test-Class-0.37.tar.gz cd Test-Class-0.37 perl Makefile.PL make make test make install
If you can’t do it the easy way, don’t forget you can do it the “Old School” way!
Categories: Perl Webmastery Tags: