Home arrow PHP arrow Page 4 - Building a Site Engine with PHP, Part 5

Improve your Blocking Skills - PHP

So you want to use your site engine that youíve been working on? Okay, now is the time for me to show you how to add plug-ins, modules, blocks, and templates to your database so that they will work with your engine. Itís not that hard to do, and with just a few simple steps, youíll be running your site off your new stylish site engine in no time.

TABLE OF CONTENTS:
  1. Building a Site Engine with PHP, Part 5
  2. Plug it in, Plug it in!
  3. All your Modules Belong to MySQL
  4. Improve your Blocking Skills
  5. Build your very own Theme Park!
By: James Murray
Rating: starstarstarstarstar / 32
July 19, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Installing the blocks is where that paper that you should have been writing the plug-in and module IDís down will come in handy. If you didnít make a list of them, now would be a good time to do so. The blocks and block_location tables are where youíll spend most of the time installing components because most blocks will share the same plug-in and module. In fact I have one plug-in that runs 27 blocks in my set up.

Blocks Table -- Five Fields

The blocks table is where you need to start. This table contains five fields that you need to fill in.

The first is block_title, which contains the title of the block. The block_title can be whatever you want it to be; this is where youíll put the title that will show up on the top of your blocks (each one is different). You can even put tags in here that will get replaced at runtime.

Then you need to fill in the block_file field, which works just like the module_file field. Just put in the name of the actual PHP file that contains your block data.

Then you have the group_ID field which corresponds with the group_ID in groups table. This enables the engine know if it should load a block depending on whoís logged in.

Following that is the plugin_ID and the mod_ID, which you should fill in with the ID of the plug-in and module that the block is dependant on. This step is really important, because if a plug-in or module fails to load, the block will not load, therefore you wonít get any errors due to the missing information provided by the plug-in or module.

Block_location Table -- Four Fields

Now in the block_location table there are four fields to fill in. The block_ID contains the ID for the block in the blocks table that is generated by an auto increment field when you install a new block. The block_col tells the engine what column the block loads in. You simply put the number of the column you want it to load in; for example if you want a block to load in column2, you just put in a 2. After that is block_row which is the number in line that the block loads from top down. If a block is the top block you just put in a 1, if itís the last in a column with 5 blocks, youíd put in a 5. And finally the blocks page. This field is rather important; it tells the engine what page to load specific block to load on. If you have a block that should show up when a person looks at the page with the URL that looks like this www.yoursite.com/?page=news_details, then youíd want your news details block to load on the news details page and not on the news summary page. For this field just put in the word that would be shown after the page= in the URL.

Not too complicated but it can get confusing after you get in the area of fifty blocks.



 
 
>>> More PHP Articles          >>> More By James Murray
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: