ďťż
Podstrony
|
telcocafeNa forum.php.pl bakuś dał kod dzięki któremu da się wklepać kod php do artykułu itd.<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); $_MAMBOTS->registerFunction( 'onPrepareContent', 'botParsePHP' ); function botParsePHP( $published, &$row, &$params, $page=0 ) { global $mosConfig_absolute_path, $mosConfig_live_site; $regex = "#{mosphp}(.*?){/mosphp}#s"; if (!$published) { $row->text = preg_replace( $regex, '', $row->text ); return; } $row->text = preg_replace_callback( $regex, 'botParsePHP_parser', $row->text ); return true; } function botParsePHP_parser(&$string) { $eval = $string[1]; ob_start(); eval(' ?' . '>' . $eval . '<' . '?php '); $string = ob_get_contents(); ob_end_clean(); return $string; } ?> Przykład strony: {mosphp} <?php phpinfo(); ?> {/mosphp} Kod skopiowałem do odpowiedniego pliku i na serwer i działa wyświetla po wpisaniu do przeglądarki direct acces... niestety nie działa mi na stronie tzn. robię moduł i kopiuję przykład ale wyświetla się tylko (przemek.info/mambo/) {mosphp} {/mosphp} mam mambo 4.5.4 pl Spróbuj wklepać tam kod bez <?php ?> Teraz wynik jest taki {mosphp} phpinfo(); {/mosphp} To na pewno dlatego, że mam 4.5.4 ale znalazłem jedną klasę na angielskim forum do 4.5.1 i też mi nie chce działać <?php /** * PHP Evaluation Mambot * author John Long <konlong@mail.mambobrothers.com> * Based on the "Code Highliting Mambot" by eddieajau **/ // $Id: moscode.php,v 1.1 2003/12/15 00:39:03 eddieajau Exp $ /** * Code Highlighting Mambot * @package Mambo Open Source * @Copyright © 2000 - 2003 Miro International Pty Ltd * @ All rights reserved * @ Mambo Open Source is Free Software * @ Released under GNU/GPL License : [url="http://www.gnu.org/copyleft/gpl.html"]http://www.gnu.org/copyleft/gpl.html[/url] * @version $Revision: 1.1 $ * @author Andrew Eddie <eddieajau@user.sourceforge.net> **/ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); $_MAMBOTS->registerFunction( 'onPrepareContent', 'botKL_PHP' ); /** * PHP Evaluation Mambot * * <b>Usage:</b> * {kl_php}...some PHP code...end with a return;{/kl_php} */ function botKL_PHP( $published, &$row, &$params, $page=0 ) { $regex = "#{kl_php}(.*?){/kl_php}#s"; // perform the replacement if($published){ $row->text = preg_replace_callback( $regex, 'botKL_PHP_replacer', $row->text ); }else { $row->text = preg_replace( $regex, '', $row->text ); } return true; } function botKL_PHP_replacer( &$matches ) { global $mosConfig_absolute_path, $mosConfig_live_site, $database; $query = "SELECT id FROM #__mambots WHERE element = 'kl_php' AND folder = 'content'"; $database->setQuery( $query ); $kl_id = $database->loadResult(); $mambot = new mosMambot( $database ); $mambot->load( $kl_id ); $bot_params =& new mosParameters( $mambot->params ); $kl_entities = $bot_params->def( 'entities','1' ); $kl_span = $bot_params->def( 'span','0' ); $kl_ob = $bot_params->def( 'ob','1' ); $kl_debug = $bot_params->def( 'debug','0' ); if ($kl_debug) { print 'Debug-KL_PHP:<br />------<br />'; print_r($matches[1]); print '<br />------<br />'; } if ($kl_ob) ob_start(); if ($kl_entities) $code = eval(html_entity_decode(@$matches[1] )); else $code = eval(@$matches[1]); if ($kl_ob) { $buf = ob_get_contents(); ob_end_clean(); $code .= $buf; } if ($kl_span) return "<span class=\"kl_php\">$code</span>"; else return $code; } ?> może ktoś umiał by to zmodyfikować do 4.5.4? tu jest jeszcze xml, każdy mambot ma swój odpowiednik xml: <?xml version="1.0" encoding="iso-8859-1"?> <mosinstall type="mambot" group="content" version="4.5.1"> <name>Imbed PHP</name> <creationDate>4/13/2005</creationDate> <version>2.0</version> <author>Konlong</author> <copyright>© 2005 John Long</copyright> <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> <authorEmail>john_-a@t-_idealagent_-do.t-_.com</authorEmail> <authorUrl></authorUrl> <description>Allows for the placement of PHP code in content items</description> <files> <filename mambot="kl_php">kl_php.php</filename> </files> <params> <param name="ob" type="radio" default="1" label="Use Output Buffering" description="Useful if you doing an include of code which uses print or echo for output"> <option value="0">No</option> <option value="1">Yes</option> </param> <param name="entities" type="radio" default="1" label="Decode HTML_entities" description="Useful if you use a WYSIWYG editor to place the mambot"> <option value="0">No</option> <option value="1">Yes</option> </param> <param name="span" type="radio" default="0" label="Wrap the results in a span" description=""> <option value="0">No</option> <option value="1">Yes</option> </param> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="debug" type="radio" default="0" label="debug" description="Feature not always available."> <option value="0">No</option> <option value="1">Yes</option> </param> </params> </mosinstall> myślałem, że to może podana wersja w xmlu nie daje włączyć ale nawet oryginały znajdujące się w folderze z mambotami mają wersję 4.5.2 Dobra rozumiem, że nikt mi nie umie pomóc, ale może dało by się zrobić coś z tym mambotem http://www.mambopl.c...p;filecatid=284 ściągnąłem go z działu do 4.5.4 i powinno działać ale też nie działa. wrzuciłem wszystkie pliki do odpowiedniego katalogu na serwerze i pliki są ok. chciałem odpalić kod php za pomocą kodu {mosmodule snippet=2} {/mosmodule} i ani z <?php ?> i bez nie chce działać. Co mam robić mam już dość tych wszystkich mambotów. Tu macie instrukcję do niego zobaczcie może czy wszystko robię dobrze (jak ktoś zna dobrze angielski): /** * @version * @package MosModule mambot - COAddOns for Mambo & Jommla * @copyright © 2006 www.ongetc.com * @info ongetc@ongetc.com [url="http://www.ongetc.com"]http://www.ongetc.com[/url] * @license GNU/GPL [url="http://www.gnu.org/copyleft/gpl.html"]http://www.gnu.org/copyleft/gpl.html[/url] . */ The hightlight of this new release are: - codeid to show article as code as as html literal - Add legacy mambot support and ability to run inside module - Same version to run as legacy or new mambot - Fix to work with Call-time pass-by-reference depreciate issue Description: MosModule mambot has the ability to display nested article, exec snippet written in PHP (without <?php ?> tags) and exec external php script file pass with parameter (with <?php ?> tags). You can see an example of that in "mosmodule\hello.php". In my mind this would give me the potential of reusing article that are common to all article without repeating the same content, make my article more dynamic enrich with php code using snippet or external php script file. With the use of the parameters you can pass variable between mosmodule and the external php script. The possibilities are endless! In summary, MosModule is a mambot to displays any module, article, exec snippet and external php script inside a content item. Usage: Please see "{ROOT}/mambots/content/mosmodule/readme.txt" for more detail. (this file) Usage: {mosmodule module=modulename} - Ex: {mosmosule module=Search} {mosmodule list} - Displays a list of available modules and block positions. {mosmodule random=FAQ} - Displays the entire section randomly {mosmodule articleid=2} - Displays an article inside another article {mosmodule codeid=2} - Displays an article inside another article as code listing {mosmodule snippet=2} - Execute and displays an article inside another article as PHP code {mosmodule phpinc=hello.php,firtname,lastname} - Include php file, Execute and displays an inside an article, please make sure to create a "mosmodule" folder under Mambo to put your php script to be execute by mosmodule due to potential security implication. You can also set the folder of your choice in the mosmodule parameter screen. Note: . Important: Make sure to save the setting at least once and enable MosModule in Mambot manager! . This is a rewrite of modulebot to be compatible with Mambo 4.5.1 or above . The default folder for external script is "mosmodule" but you can change it in param screen . Please see hello.php for a sample on passing variable between mosmodule and external script . Snippet should not have <?php ?> tags where as phpinc should have the tags . Use can also use mosmodule to get RSS feeds from anywhere using the user module with RSS URL Legacy mambot notes: - To use mosmodule as a legacy mambot . copy {ROOT}/mambots/content/mosmodule.php to {ROOT}/mambots - To run inside a module to call other module, hack the includes/frontend.html.php around line 51 Replace this: echo $module->content; With this: $mosmodulefunc=$mosConfig_absolute_path."/mambots/content/mosmodule/mosmodule_func.php" ; if (file_exists($mosmodulefunc)) { include_once($mosmodulefunc); } if (function_exists('mosmodule_bot')) { echo mosmodule_bot($module->content); } else echo $module->content; or this to allow php code in module $mosmodulefunc=$mosConfig_absolute_path."/mambots/content/mosmodule/mosmodule_func.php" ; if (function_exists('mosmodule_bot')) { echo eval('?>'.mosmodule_bot($module->content).'<?php '); } else echo eval('?>'.$module->content.'<?php '); By default, the module will fill the width of the content area. If you wish to control the width and positioning of modules in content area, you will want to enclose the mosmodule tag(s) in a div and either assign a class to controll the display in your template_css.css file, or use inline styles (if you are using a WYSIWYG editor such as htmlarea2, you will need to switch to source mode in order to create the <div> tag). Download sites: * [url="http://mamboxchange.com/projects/coaddons/"]http://mamboxchange.com/projects/coaddons/[ /url] * [url="https://sourceforge.net/projects/coaddons"]https://sourceforge.net/projects/coaddons[ /url] * [url="http://developer.joomla.org/sf/sfmain/do/viewProject/projects.coaddons"]http://developer. joomla.org/sf/sfmain/do/v...ojects.coaddons[/url] |
|||
Sitedesign by AltusUmbrae. |