Recent Topics

1 Dec 27, 2004 21:21    

I did this because I wanted to be able to edit all my custom skins from inside the admin area rather than make the edits on my machine and upload them.

Keep in mind by doing this you will have to give the proper permissions to the files in your skins folders so you can edit them via the admin area.

in the admin folder make copies of the b2template.php file, as many as you need. I made 8 copies. Rename these copies to reflect your template name. i.e. b2templatemyskin.php

I renamed mine depending on the skin name so for me it became b2templatemyskin.php. It also makes it easier to keep in mind which edit page goes where in case I want to edit a specific one later.

In the b2template.php copies you will have to change some code to make it work with your newly created skin. You will need to do this for each skin you have created:

Line 32:

case "update":
	// Determine the edit folder:
	$edit_folder = get_path('skins'). '/custom';

Line 50:

	// Determine the edit folder:
	$edit_folder = get_path('skins'). '/custom';

Line 106:


	<p><?php echo T_('This screen allows you to edit the <strong>custom skin</strong> (located under /skins/custom).

Line 110:

	// Determine the edit folder:
	if( empty($edit_folder) ) $edit_folder = get_path('skins'). '/custom';
	//lists all files in edit directory
	if( !is_dir($edit_folder) )
	{

In all the above bits of code change /custom to your skin directory name. example: /myskin

Find and replace worked well for this but it could be done without it since it is only four places that need this edit.

Of course there are other areas you might also want to change but don't need to be changed. Basically they are just text output for the edit page in your admin:

Line 18:

$admin_pagetitle = T_('Custom skin template editing');

This can be changed to reflect your skin name if you want. For example:

$admin_pagetitle = T_('My Skin Name template editing');

Line 106:

<p><?php echo T_('This screen allows you to edit the <strong>custom skin</strong> (located under /skins/custom).

Again you change 'custom skin' to the name of your skin if you like. Also you can change the located under to write your directory name. I did this just to save confusion later so mine looks like this:

<p><?php echo T_('This screen allows you to edit the <strong>My Skin Name</strong> (located under /skins/myskin).

I do a lot of late night bleary eyed coding so I can get confused pretty easy since I am half asleep LOL.

Now there is one more group of code you will have to edit to get this to work. You will have to replace b2template.php filename in each of your new skin edit pages with the name of your new skin edit page, i.e. b2templatemyskin.php, as follows:

Line 41:

	header("Location: b2template.php?file=$file&a=te");

Line 82:

	<form name="template" action="b2template.php" method="post">

Line 126:

				<li><a href="b2template.php?file=<?php echo $this_file; ?>"><?php echo $this_file; ?></a>

Again find and replace can be used but it can be done easily one by one since it is only three places.

These must be changed to reflect your skin edit page name or it won't work.

Now upload all your new template pages back to the admin directory on your server. You are almost done.

To make each edit page accessible from inside your admin open up the original b2template.php file.

Find line 107:

<p><?php echo T_('You can edit any of the following files (provided it\'s writable by the server, e.g. CHMOD 766)') ?>:</p>

After this is a good place to put links to your other skin edit pages so you can access them easily from inside admin:

	<p><?php echo T_('Choose another Skin to edit here:<p> <a href="b2templatemyskin1.php">My Skin 1</a>, <a href="b2templatemyskin2.php">My Skin 2</a>, <a href="b2templatemyskin3.php">My Skin 3</a>, <a href="b2templatemyskin4.php">My Skin 4</a>, <a href="b2templatemyskin5.php">My Skin 5</a>, <a href="b2templatemyskin6.php">My Skin 6</a>, <a href="b2templatemyskin7.php">My Skin 7</a>, <a href="b2templatemyskin8.php">My Skin 8</a></p> ') ?></p>

That is it in a nutshell. I have had this working for me a few days now and I am really enjoying how much time it saves me. I hope someone else finds this little bit to be useful. :)

Always keep a back up copy of all original files before you go editing anything. ;)

Heidi


Form is loading...