繁体   English   中英

在joomla中打印

[英]printing in joomla

我需要帮助来解决打印问题,这完全阻塞了我的项目。 确切地说,我有两篇包含PHP代码的Joomla文章(我使用的是Free Sourcerer插件)。

第一篇文章包含以下代码:

{source}
  <form method="post" action="http://localhost/essai/index.php?option=com_content&view=article&id=2">
     <p>
         <input type="text" name="num" />
     </p>
   <input type="submit" value="Display the value of num" />
  </form>
{/source}

ID为2的第二篇文章包含以下代码:

{sourcer}
   if (isset ($_POST [ 'num'])) { 
       $Address=J Request :: getVar( 'num', '', 'post'); 
       echo $Address; 
   } else { 
       echo "num does not exist";
   }
{/source}

我的目标是在ID为2的第二篇文章中恢复num形式的输入字段的值并打印。 当我单击按钮“显示num的值”时,将检索并显示值区域num ,但是当我单击链接以打印文章时,打开的窗口中将显示“不存在num”。 当我打印文章时, $ _POST ['num']不存在!

这是在Joomla或其他打印机中打印的问题吗? 请帮帮我。

注意 :我使用Joomla_2.5.9,集成在joomla中的Template Beez2,无Sourcerer v4.1.3

为了使此功能生效,您需要进行2个更改。

1-我已经将表格包含在PHP中

{source}
<?php       
    echo'<form method="post" action="http://localhost/essai/index.php?option=com_content&view=article&id=2">' .
        '<p>' .
        '<input type="text" name="num" />' .
        '</p>' .
        '<input type="submit" value="Display the value of num" />' .
        '</form>';
?>
{/source}

2-从代码中删除一些多余的空间

{source}
<?php  
   if (isset($_POST['num'])) { 
       $Address=JRequest :: getVar('num','','post'); 
       echo $Address; 
   } else { 
       echo "num does not exist";
   }        
?>
{/source}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM