PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : یکی مشکل این کامپوننت رو بهم بگه



solymani
06-10-2007, 12:56 PM
دوستان اسن کامپوننت رو اگه می شه یک نگاه بندازین ببینین مشکلش کجاست.
کامپوننت hello_world هستش. تو قسمت ادمین مشکل داره. اگه با IE وارد بخش مدیریتش بشی پیغام خطا می ده و صفحه رو لود نمی کنه. با ff هم تست کردم میاره ولی منوهای بالا رو نمیاره و نمی تونم چیزی اضافه کنم.

فایل admin.hello_world.html.php

<?php
//hello_world Component//
/**
* Content code
* @package hello_world
* @Copyright (C) 2004 Doyle Lewis
* @ All rights reserved
* @ hello_world is Free Software
* @ Released under GNU/GPL License : <b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
* @version 1.0
**/

defined( &#039;_VALID_MOS&#039; ) or die( &#039;Direct Access to this location is not allowed.&#039; );
require_once( $mainframe-&gt;getPath( &#039;toolbar_html&#039; ) );

if($task) {
switch($task) {
case &#039;new&#039;:
case &#039;edit&#039;:
$act = &quot;edit&quot;;
break;
}
}
if ($act) {
switch ( $act ) {
case &#039;edit&#039;:
menuHello_world::EDIT_MENU();
break;

case &#039;text&#039;:
menuHello_world::TEXT_MENU();
break;
}
}
?&gt;


فایل admin.hello_world.php

&lt;?php
//hello_world Component//
/**
* Content code
* @package hello_world
* @Copyright (C) 2004 Doyle Lewis
* @ All rights reserved
* @ hello_world is Free Software
* @ Released under GNU/GPL License : <b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
* @version 1.0
**/
defined( &#039;_VALID_MOS&#039; ) or die( &#039;Direct Access to this location is not allowed.&#039; );
require_once($mosConfig_absolute_path.&quot;/administrator/components/com_hello_world/class.hello_world.php&quot;);
require_once( $mainframe-&gt;getPath( &#039;admin_html&#039; ) );
switch ($act) {
default:
$task = &quot;showText&quot;;
break;
}

switch ($task) {
case &quot;save&quot;:
save( $option );
break;

case &quot;delete&quot;:
delete( $option, $id );
break;

case &quot;new&quot;:
$id = &#039;&#039;;
edit( $option, $id );
break;

case &quot;edit&quot;:
save( $option, $id[0] );
break;

case &quot;showText&quot;:
showText( $option );
break;
}
function save( $option ) {
global $database;
$row = new mosHello_world( $database );

if (!$row-&gt;bind( $_POST )) {
echo &quot;&lt;script&gt; alert(&#039;&quot;.$row-&gt;getError().&quot;&#039;); window.history.go(-1); &lt;/script&gt;n&quot;;
exit();
}
if (!$row-&gt;store()) {
echo &quot;&lt;script&gt; alert(&#039;&quot;.$row-&gt;getError().&quot;&#039;); window.history.go(-1); &lt;/script&gt;n&quot;;
exit();
}
mosRedirect( &quot;index2.php?option=$option&quot;, &quot;Saved&quot; );
}

function edit( $option, $uid ) {
global $database;
$row = new mosHello_world( $database );
$row-&gt;load( $uid );

HTML_hello_world::edit( $option, $row );
}

function delete( $option, $cid ) {
global $database;
if (!is_array( $cid ) || count( $cid ) &lt; 1) {
echo &quot;&lt;script&gt; alert(&#039;Select an item to delete&#039;); window.history.go(-1);&lt;/script&gt;n&quot;;
exit;
}
if (count( $cid )) {
$cids = implode( &#039;,&#039;, $cid );
$database-&gt;setQuery( &quot;DELETE FROM mos_hello_world WHERE id IN ($cids)&quot; );
if (!$database-&gt;query()) {
echo &quot;&lt;script&gt; alert(&#039;&quot;.$database-&gt;getErrorMsg().&quot;&#039;); window.history.go(-1); &lt;/script&gt;n&quot;;
}
}
mosRedirect( &quot;index2.php?option=$option&quot; );
}

function showText($option) {
global $database;
# Do the main database query
$database-&gt;setQuery( &quot;SELECT * FROM mos_hello_world ORDER BY id&quot; );
$rows = $database-&gt;loadObjectList();
if ($database-&gt;getErrorNum()) {
echo $database-&gt;stderr();
return false;
}
HTML_hello_world::showText( $option, $rows );
}
?&gt;
فایل class.hello_world.php

&lt;?php
defined(&#039;_VALID_MOS&#039; ) or die( &#039;Direct Access to this location is not allowed.&#039; );
class mosHello_world extends mosDBTable {
// INT(11) AUTO_INCREMENT
var $id=null;
// TEXT
var $text=null;
// TINYINT(1)
var $published=null;

function mosHello_world( &amp;$db ) {
$this-&gt;mosDBTable( &#039;mos_hello_world&#039;, &#039;id&#039;, $db );
}
}
?&gt;


فایل hello_world.php

&lt;?php
defined( &#039;_VALID_MOS&#039; ) or die( &#039;Direct Access to this location is not allowed.&#039;);

global $database;
$query = &quot;SELECT * FROM mos_hello_world&quot;;
$database-&gt;setQuery( $query );
$rows = $database-&gt;loadObjectList();

echo(&quot;&lt;table width=&#039;100%&#039; border=&#039;0&#039;&gt;&quot;);
for($i=0; $i &lt; count( $rows ); $i++) {
$row = $rows[$i];

echo(&#039;&lt;tr&gt;&lt;td&gt;&#039;);
echo $row-&gt;text;
echo(&#039;&lt;/tr&gt;&lt;/td&gt;&#039;);
}
echo(&#039;&lt;/table&gt;&#039;);
?&gt;


فایل hello_world.xml

&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;mosinstall type=&quot;component&quot;&gt;
&lt;name&gt;hello_world&lt;/name&gt;
&lt;creationDate&gt;04/15/2004&lt;/creationDate&gt;
&lt;author&gt;Doyle Lewis&lt;/author&gt;
&lt;copyright&gt;This component in released under the GNU/GPL License&lt;/copyright&gt;
&lt;authorEmail&gt; support@mambo-hosting.com &lt;/authorEmail&gt;
&lt;authorUrl&gt;<b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
&lt;version&gt;1.0&lt;/version&gt;
&lt;files&gt;
&lt;filename&gt;hello_world.php&lt;/filename&gt;
&lt;/files&gt;
&lt;install&gt;
&lt;queries&gt;
&lt;query&gt;DROP TABLE IF EXISTS `mos_hello_world`;&lt;/query&gt;
&lt;query&gt;CREATE TABLE `mos_hello_world` (
`id` INT NOT NULL AUTO_INCREMENT,
`text` TEXT NOT NULL,
`published` TINYINT(1) NOT NULL,
PRIMARY KEY (`id`)
)
&lt;/query&gt;
&lt;/queries&gt;
&lt;/install&gt;
&lt;uninstall&gt;
&lt;queries&gt;
&lt;query&gt;DROP TABLE IF EXISTS `mos_hello_world`;&lt;/query&gt;
&lt;/queries&gt;
&lt;/uninstall&gt;
&lt;installfile&gt;
&lt;filename&gt;install.hello_world.php&lt;/filename&gt;
&lt;/installfile&gt;
&lt;uninstallfile&gt;
&lt;filename&gt;uninstall.hello_world.php&lt;/filename&gt;
&lt;/uninstallfile&gt;
&lt;administration&gt;
&lt;menu&gt;Hello World&lt;/menu&gt;
&lt;submenu&gt;
&lt;menu act=&quot;all&quot;&gt;Show Text&lt;/menu&gt;
&lt;/submenu&gt;
&lt;files&gt;
&lt;filename&gt;admin.hello_world.php&lt;/filename&gt;
&lt;filename&gt;admin.hello_world.html.php&lt;/filename&gt;
&lt;filename&gt;class.hello_world.php&lt;/filename&gt;
&lt;filename&gt;toolbar.hello_world.php&lt;/filename&gt;
&lt;filename&gt;toolbar.hello_world.html.php&lt;/filename&gt;
&lt;/files&gt;
&lt;/administration&gt;
&lt;/mosinstall&gt;


فایل install.hello_world.php

&lt;?php
function com_install() {
echo &quot;Thank you for using this component. Please contact me at support@mambo-hosting.com with any questions&quot;;
}
?&gt;


فایل toolbar.hello_world.html.php

&lt;?php
//hello_world Component//
/**
* Content code
* @package hello_world
* @Copyright (C) 2004 Doyle Lewis
* @ All rights reserved
* @ hello_world is Free Software
* @ Released under GNU/GPL License : <b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
* @version 1.0
**/
defined( &#039;_VALID_MOS&#039; ) or die( &#039;Direct Access to this location is not allowed.&#039; );
class menuHello_world {
function TEXT_MENU() {
mosMenuBar::startTable();
mosMenuBar::publish(&#039;publish&#039;);
mosMenuBar::unpublish(&#039;unpublish&#039;);
mosMenuBar::divider();
mosMenuBar::addNew(&#039;new&#039;);
mosMenuBar::editList(&#039;edit&#039;, &#039;Edit&#039;);
mosMenuBar::deleteList( &#039; &#039;, &#039;delete&#039;, &#039;Remove&#039; );
mosMenuBar::endTable();
}
function EDIT_MENU() {
mosMenuBar::startTable();
mosMenuBar::back();
mosMenuBar::save(&#039;save&#039;);
mosMenuBar::spacer();
mosMenuBar::endTable();
}

}
?&gt;


فایل toolbar.hello_world.php

&lt;?php
//hello_world Component//
/**
* Content code
* @package hello_world
* @Copyright (C) 2004 Doyle Lewis
* @ All rights reserved
* @ hello_world is Free Software
* @ Released under GNU/GPL License : <b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>
* @version 1.0
**/

defined( &#039;_VALID_MOS&#039; ) or die( &#039;Direct Access to this location is not allowed.&#039; );
require_once( $mainframe-&gt;getPath( &#039;toolbar_html&#039; ) );

if($task) {
switch($task) {
case &#039;new&#039;:
case &#039;edit&#039;:
$act = &quot;edit&quot;;
break;
}
}
if ($act) {
switch ( $act ) {
case &#039;edit&#039;:
menuHello_world::EDIT_MENU();
break;

case &#039;text&#039;:
menuHello_world::TEXT_MENU();
break;
}
}
?&gt;

radmehr
06-10-2007, 01:15 PM
شما خود کامپوننت رو بزارید تا بررسی بشه

solymani
06-10-2007, 02:40 PM
بسیار خوب
<b><font color=red>فقط کاربران عضو انجمن می توانند لینک ها را مشاهده کنند</font></b>

hossein.shokrzadeh
06-14-2007, 08:04 PM
سلام
تو فايل :toolbar.hello_world.php
اين كد رو جايگزين كنيد:

if ($act) {
switch ( $act ) {
case &#039;edit&#039;:
menuHello_world::EDIT_MENU();
break;

case &#039;text&#039;:
menuHello_world::TEXT_MENU();
break;
default:
menuHello_world::TEXT_MENU();
break;
}
}
موفق باشيد
يا علي