Hy,
I'm new in Joomla and PHP.
I have a question about listing key value pairs. I want to make my own component. For this I want that the user can add some properties in the admin part. I want that the admin can enter the data like this (the data are separated by \n):
Date=29. August 2007
Name=mr. xyz
Value1=17,3
Now I want do to something like this:
foreach ($params as $KeyValueItem)
{
echo '' .$KeyValueItem->key .'';
echo '' .$KeyValueItem->value .'';
}
I try it with: mosParseParams, JParams, explode, ... but it ditn't work.
Pleas help.
Thanks in advance,
Hansen
Key Value list Topic is solved
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
- jalil
- Joomla! Enthusiast

- Posts: 128
- Joined: Wed Jul 04, 2007 4:54 am
- Location: Kuala Lumpur, Malaysia
- Contact:
Re: Key Value list
foreach ($params as $Key=>$ValueItem)hansen77 wrote: Hy,
I'm new in Joomla and PHP.
I have a question about listing key value pairs. I want to make my own component. For this I want that the user can add some properties in the admin part. I want that the admin can enter the data like this (the data are separated by \n):
Date=29. August 2007
Name=mr. xyz
Value1=17,3
Now I want do to something like this:
foreach ($params as $KeyValueItem)
{
echo '' .$KeyValueItem->key .'';
echo '' .$KeyValueItem->value .'';
}
I try it with: mosParseParams, JParams, explode, ... but it ditn't work.
Pleas help.
Thanks in advance,
Hansen
{
echo '' .$Key.'';
echo '' .$ValueItem.'';
}
echo " now buy me a free beer";
Re: Key Value list
or ...
Was it TIMTOWD ?
Plamen(dp)
Code: Select all
while ( list($k, $v) = each($params) ) {
echo '<td>' . $k . '</td>';
echo '<td>' . $v . '</td>';
}
echo " <h1>now buy me a free beer</h1>";
Was it TIMTOWD ?
Plamen(dp)
Some day I'll change my signature to something meaningful...some day...
Re: Key Value list
It was my impression he wanted to be able to edit the values. You guys don't seem to account for this.
I would start by creating a config.xml file in the root directory of my component. It might look like:
Then, in my view I would add the code:
This allows you to do global parameters for your component.
Ian
I would start by creating a config.xml file in the root directory of my component. It might look like:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<config>
<params>
<param name="show_noauth" type="radio" default="0" label="Show UnAuthorized Links" description="TIPLINKS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="show_title" type="radio" default="1" label="Show Article Title" description="Show/Hide the articles title">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="link_titles" type="radio" default="0" label="Linked Titles" description="TIPIFYESTITLECONTENTITEMS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="show_intro" type="radio" default="1" label="Show Intro Text" description="Show/Hide the intro text">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="show_section" type="radio" default="0" label="Section Name" description="PARAMSECTION">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
</params>
</config>
Code: Select all
JToolBarHelper::preferences('com_example', '550');
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
