Archive for July, 2008

Writing BR in XML

to do this we simply use

<![CDATA[
<br/>
]]>

Fixing TinyMCE width for joomla 1.5

I was trying to fix the TinyMCE for joomla 1.5 in all ways. None worked. I even went into the core files and tried to change them. Finally I found the sloution by adding those lines to my template CSS

.mceToolbarTop * {
float:left;
}

.mceToolbarTop select {
width:auto!important;
}

.mceToolbarTop option {
float:none;
}

Creating new pages for Zen Cart

this article is taken from Zen Cart Wiki http://www.zen-cart.com/wiki/index.php/Creating_new_pages

Overview

You may want to add additional pages to your Zen Cart™ store. Here are the basics steps you should follow. We will assume your new page is named myNewPage.

Components of the new page

In order for the Zen Cart™ system to pick up the new page, you will need to include four components:

  • A new directory, includes/modules/pages/myNewPage/, containing a file called header_php.php
  • A new file in the directory includes/templates/template_default/templates called tpl_myNewPage_default.php
  • A new file, includes/extra_datafiles/myNewPage.php, defining your new page’s filename for the Zen Cart™ system
  • A new language file, includes/languages/english/myNewPage.php

Naming your files

It’s important that all these new components use the same name for your new page. (The only partial exception is the extra_datafiles file; see below.) Be sure that your new pages directory name, language file name, and template file name use exactly the same name for your new page.

The header_php.php file

At a minimum, this file should contain the following:

<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2006 The zen-cart developers                           |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id: header_php.php $
//
  require(DIR_WS_MODULES . 'require_languages.php');
  $breadcrumb->add(NAVBAR_TITLE);
?>

Additionally, you can add in whatever processing you need to do on your page to this file. Have a look at the other pages in the includes/modules/pages/ directory to get an idea of what this file is for.

The template file

The new template file, includes/templates/template_default/templates/tpl_myNewPage_default.php, contains the main HTML body for your page. A good starting point for this page is to copy one of the other pages in this directory and adjust it to fit your new page’s desired format.

Image:info.png Custom templates
You can copy your new template page from template_default to a custom template directory if you’d like to make template-specific changes to the layout (for example, for a seasonal design).

The extra_datafiles file

This file, includes/extra_datafiles/myNewPage.php, should contain the following line:

<?php
define(FILENAME_MYNEWPAGE, 'myNewPage');
?>

The constant on the left, FILENAME_MYNEWPAGE, is the tag you will use to link to your new page from other locations in your shop. The string on the right, myNewPage, must exactly match the name of your new includes/modules/pages/ directory.

Image:info.png Just one new file
You don’t need a separate new extra_datafiles file for each new page you create. If you are adding several new pages, you can place all the filename defines into one file, and give that file any name whatsoever. All the files in the extra_datafiles folder are loaded in for every page.

The language file

The language file for your page should contain definitions for all the local text elements on your page; for example:

<?php
define('NAVBAR_TITLE', 'New Page');
define('HEADING_TITLE','My Cool New Page');
?>

Other languages

Don’t forget to make a copy of the language file for the other languages in your shop.

Cheat Sheet

Using the rhuk_milkyway template as an example, here is a brief summary of the priniciples we’ve looked at.

Customise the Component Output

To override a component layout (for example the default layout in the article view), copy:

/components/com_content/views/article/tmpl/default.php

to:

/templates/rhuk_milkyway/html/com_content/article/default.php

Read more about component output.

Customise the Module Output

To override a module layout (for example the Latest News module using the rhuk_milkyway template), copy:

/components/mod_latest_news/default.php

to:

/templates/rhuk_milkyway/html/mod_latest_news/default.php

Read more about module output.

Add New Module Styles

To add new module styles (chrome), add them to the following file:

/templates/rhuk_milkyway/html/modules.php

Read more about module styles.

Customise the Pagination Links

To customise the way the items-per-page selector and pagination links display, edit the following file:

/templates/rhuk_milkyway/html/pagination.php

Read more about pagination.

Overriding joomla Menu module

To override joomla menu module (whether its left or right or upper one ) you have to copy the following file :

/templates/system/html/modules.php

to your template

/templates/yourtemplate/html/modules.php

and overright the function you want.

ofcourse you can also create your own menu module just you add a function to modules.php

/*
 * Module chrome that wraps the module in a definition list
 */
function modChrome_dlist($module, &$params, &$attribs)
{ ?>
	<dl class="<?php echo $params->get('moduleclass_sfx'); ?>">
	<?php if ($module->showtitle != 0) : ?>
		<dt>
			<?php echo $module->title; ?>
		</dt>
	<?php endif; ?>
		<dd>
			<?php echo $module->content; ?>
		</dd>
	</dl>
	<?php
}
 

then you can add this when calling the menu module

<jdoc:include type="modules" name="left" style="dlist" />

the default styles are :
  • table (was 0 and is the default)
  • horz (was 1)
  • none (was -1)
  • xhtml (was -2)
  • rounded (was -3)
  • outline (new – used to preview module positions – see screenshot above)

was before :

  • 0 (the default) displayed modules in a vertical table
  • 1 displayed them in a horizontal table
  • -1 displayed the raw module output
  • -2 displayed the modules in a XHTML compatible format with the title in a H3 tag.
  • -3 displayed modules in a set of nested DIVs that allowed for rounded-corner techniques

            

Integrating phpbb3 with Joomla

talking about integrating phpbb3 users to joomla.
I’ve tried JFUSION and darn its the worst module I have ever used (its so messed up and complicated more than expected)
I’ve tried to find another and hopelessly, I found nothing that can help me to do that COMPLICATED job (being sarcastic if you havnt figured that yet) honestly I was starting to make one on my own but wait wait there is a great one out there called rokbridge, or ROKBRIDGE.
And yes its the best it creates a non-invasive bridge solution for the fantastic new phpBB3 forum package.
you can check it here :

http://www.rocketwerx.com/products/rokbridge/

Joomla Upload Images Problem

The first problem faced me while trying to upload is not being able to upload using Media manager at all.

to solve this problem I’ve added those two lines to .httaccess

SecFilterEngine Off
SecFilterScanPOST Off

Now the second problem was not being able to upload in front end, and to solve this problem did the following :

Go to admin panel -> Site Menu -> Global Configuration -> System -> Enable Flash Uploader (Set to no)

and thats it!

Password Checker Jquery

this article is taken from :

http://simplythebest.net/scripts/ajax/ajax_password_strength.html

AUTHOR: Digital Spaghetti
TYPE: Open Source MIT License
BROWSERS: JavaScript enabled IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+

To install the script on your Web page follow these instructions:

1) Download this ZIP file with jQuery 1.2.1 and jquery.pstrength-min.1.2.js. Unpack the files and upload both to your server.

2) Insert this anywhere before the password field on the page:

<script type=”text/javascript” src=”js/jquery.js”></script> // adjust the path as is required
<script type=”text/javascript” src=”js/jquery.pstrength-min.1.2.js”>
</script>
<script type=”text/javascript”>
$(function() {
$(‘.password’).pstrength();
});
</script>

3) Insert class=”password” into your input box tag to identify a password box:

<INPUT class=”password” type=password name=”Password”>

4) Insert these tags into your CSS and modify as is needed:

.password {
font-size : 12px;
border : 1px solid #cc9933;
width : 200px;
font-family : arial, sans-serif;
}
.pstrength-minchar {
font-size : 10px;
}

You can adjust a few more settings inside the jquery.pstrength-min.1.2.js script, such as messages, length/height of the bar, and so forth.

Connecting Joomla to database

preparing the query

// Get a database object
$db = JFactory::getDBO();

$query = "SELECT * FROM #__example_table WHERE id = 999999";
$db->setQuery($query);

of course using the Database

Basic Query Execution

- query (This should be user after Set Query if you want to use getNumRows)

Query Execution Information

- getAffectedRows
-explain
-insertid

Insert Query Execution
-insertObject

Single Value Result

-loadResult

Single Row Results

-loadObject
-loadRow
-loadResultArray

Multi-Row Results

-loadObjectList
-loadRowList
-loadAssocList

Misc Result Set Methods

-getNumRows

a nice code would go like

$database = JFactory::getDBO();
$user_name=$_POST['username'];
$query = "SELECT * FROM #__users";
$database->setQuery($query);
$existing_users=$database->loadResultArray();
if (in_array($user_name, $existing_users)) {.. do something }
            

Transparent PNG on IE

Transparent PNG on Internet explorer can be a bit painful but here is a code that can somehow solve the problem on IE6 and earlier (didn’t try it on a version earlier than IE6 honestly)

<SPAN
style=”DISPLAY: inline-block; FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’images/my-image.png’); WIDTH: 120px; HEIGHT: 74px”><IMG
style=”FILTER: progid:DXImageTransform.Microsoft.Alpha(opacity=0)” height=74
src=”images/my-image.png” width=120></SPAN>

Return top

INFORMATION

Change this sentence and title from admin Theme option page.