21 November 2013

Joomla: Table Menu

After experimenting with `#__menu` table I have discovered many interesting features.

There is a DB Table called #__menu in the joomla installation database. The function of each column is stated below.

id(INT) Primary key.

title(VARCHAR) Display name of the menu. Very important field.

Menu type(VARCHAR) *Tells if the menu is ‘main menu’, ‘top menu’ , ‘left-menu’ …. Admin menus are supposed to have ‘main’ value. But whether they are displayed on the back end or not is determined by ‘client_id’ field (see below), not here.*

alias(VARCHAR) Alias of ‘title’. But it doesn’t make any effect if it is populated or not. I tried to populate it and left the ‘title’ field blank. Then the menu became blank. But if I left ‘alias’ blank and fill ‘title’, the menu got text.

note(VARCHAR) Remark (or note).

path(VARCHAR) Path name to be displayed in the browser address bar. It doesn’t have to relate with the ‘link’ information. (But both ‘path’ and ‘link’ fields have to be filled in order the menu to work properly).

link(VARCHAR) URL. Tells where the system will go when the menu is clicked. Important.

type (VARCHAR) Tells if the menu is component or url(external link) … . (Seems, it is just an ‘extra’ information – no visible effect on the menu).

published (TINYINT)
1 – Published. 0 – Not published. Hide/Show the menu in the front end.


parent_id (INT)
0- ‘Main Item root’ value. It should exist only once.
1- List among menu items on level one.
x- If this value is given another menu’s id then it will automatically become a child (second level) menu and ‘pops out ‘of its parent menu.


level (INT) Level is expected to reflect its position in the menu hierarchy. Eg. If the menu has a parent of level one, its level must be 2. If it has a parent of level 5 it has to be level 6 menu. But Joomla seems to calculate its actual level by looking to its parents and ignore this value.

component_id (INT) Component id. Value is taken from #__extensions table. (But emptying this field doesn’t seem to have any effect).

ordering (INT) Ordering (standard joomla column).

checked_out (INT) Check out (standard joomla column).

checked_out_time (TIMESTAMP) Check out time (standard joomla column).

browserNav (TINYINT) ?

access (INT) Very important field.
1 – Public
2 – Registered users only.
3 – Special Users (Eg. Managers and Admins )


img (VARCHAR) Image path if you want the menu have a background image.

template_style_id (INT) Template Id attached to while viewing the page associated with this menu.

params (TEXT) Component configuration data.

lft (INT) ?

rgt (INT) ?

home (TINYINT) Joomla has to have one and only one default page. This value determines this.
1 – This page is default.
0 – Not default. Only one menu has to have value 1. (Most of the time ‘home’).
language (CHAR) For which languages the menu displays.

client_id (TINYINT)
0 – Open to public.
1 – Back end menu. Even if the menu is given a back end menu item as a parent_id, if ‘client_id’ has value of 0, the menu will not display in admin side. But whatever value you give in ‘Menu type’ field, as long as ‘client_id’ value is 1 it will display in the back end.


Scenarios:
Menu type => ’main’ client_id =>’1’, published=> 1/0: In this case menu is only displayed in the back end. Published value has no effect.

Menutype=> ‘mainmenu’, ‘client_id’=>1, published=>1: The menu is displayed in both back end and front end. Published value determines its visibility. Whether the ‘menutype’ value is ‘main’ ,’mainmenu’, ‘top-menu’ … has no effect on its visibility in back end – only ‘client_id’ matters.

Menutype=> ‘mainmenu’, ‘client_id’=>1, published=>0: Has the same effect for admin side as the scenario above. But in front side, the menu is not visible (with published state 0).
ref:http://stackoverflow.com/questions/17142321/adding-joomla-menu-for-new-component-directly-in-db-joomla-2-5

Joomla Component: options

Option untuk component Joomla 3 disimpan di table _extensions, field params.
Data disimpan dalam format json.

Code utk retrieve(dlm Model):

jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams(JRequest::getVar('option')); // Get parameter helper
$id = $params->get('email'); // Get an individual parameter

contoh data dlm field params:
{"email":"myemail@yourcompany.com","show_date":"1"}

18 November 2013

joomla url parameter

1) http://example.com/index.php?option=com_<name>&view=[&task=<mytask>]

a) task : run method <mytask> dalam class <name>Controller, yg ada dalam file [components/com_<name>/controller.php]


2) http://example.com/index.php?option=com_<name>&view=<myview>&format=ajax

a) view : pakai  fail [components/com_<name>/views/<myview>/view.ajax.php]
default format : html

hacked install joomla 3 component


1)minimum file
components_dir

  • com_komponen
    • komponen.php

2) daftar komponent dalam table extensions

INSERT INTO `#__extensions`
(`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`)
VALUES (0, 'Komponen Den', 'component', 'com_komponen', '', 1, 1 )

relatif


git remote


Nak clone libemu pada github dan cipta branch utk patch utk isu test al, 3d (a8 d3)
  1. Create new repo kat github
  2. clone ke local
  3. git remote add carnivore git://git.carnivore.it/libemu.git
  4. git fetch carnivore
  5. git checkout master (jika bukan dlm branch master)
  6. git merge carnivore/master
  7. git push origin master

ubuntu desktop menu

/usr/share/applications/program_name.desktop

Contoh file utk Eclipse(Applications -> Programming -> Eclipse)

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=eclipse
Exec=eclipse
Terminal=false
Categories=Development;IDE;Java;

04 November 2013

md5 hash : php vs linux bash

Hasil dua hash tak sama.

md5("anakomak")
vs
echo "anakomak" | md5sum

sebab:
echo dalam bash akan tambah extra character (new line)

solution:
echo -e "anakomak\c" | md5sum         <<== baru sama.

man echo:
-e     enable interpretation of backslash escapes
\c     produce no further output

paksa guna https utk phpmyadmin



File: phpMyAdmin’s config.inc.php

// place this at the bottom somewhere
$cfg['ForceSSL'] = true;