Firstly i want to explain how my script works..
I'am using script named TSUE and source code protect by ioncube. Script has own plugins system kind of like vbulletin's Addons system. For using this system i need to create new php function to get data from database and i need to create a template for use(show) them as i want.
I created very simple plugin sample code. I'm getting tid and added coloum in tsue_torrents table with this function;
and using by this template i can show this data which page i want!
here is template
(template name is example btw. need to call that template using by eval in function)
<div class="widget">
<h4>Plugins Example</h4>
<br />
{$output}
</div>
Everything is look fine
But when i add this plugins on my main page or anypage of script I getting error like this;
��\IsG�>��%x!��n�(.���d)D�94��]J��]�$A����4a}�.sҍ��z_VU/ #��/��#-�YYY�U�w��|������~�ܦ�Lz���ѷk����SK�z��н� �ч�v)7�q�m"���u�c&O:�$B�����Nm���œ �m6OOO<!І�/rP�V�5��f�� �s%�#;�� �4MT*S_t���=�����n������˷��7��D�Lw���4S�l�w�%#u��� Ⱥ/����p?�S�s�]�?o �c_�=�~*�u4�]��/*�'B-<[�<�T�ϓ�J'S`�>w�*?s���/�1K�ߩ�9j$:_��F<���O:��g~G79��~t���1��8�|��$��b?��H�T����L:)pq�C���P�4����Ӑ�+G|(zC�C�&�8�:�����9je)!����$�1�)�g1��p�B���̐g!-��N���D*' �Q*�o5�NJ<'%Ha��v,#A_$<���φ2��F�z.O�0J$��&.k,����6]�M�'9��&B#��*�4���Yʾ�Q�i� ���A�P��yV�n��ݴ��tJ?�&8�mO�h�3�ד(Jk�h��iVY��8v��Ô��k��Gˌ����B���b�5�"}��g��c>��vU�}���.l�:h��� `k��4KB=Ȃo�K 0QCz##=;���k�& 7m�+�Q4n�"m�I��E��x�>>�zNO���Ta�M䉆�H�}��v9k�Ӫ���a+�+��#��R����=h7-�H�����R�S�3�a���O�zݨʜ�Ԩu�Ғ��ԮL�mI>i��#�n��f��Juj�=_��0<��zyj�U�9�Z�k�y��H��J�0>����'8L�Z?K�(��QF�B7�������E�uB:�$�i����m�hV�F��AHU�փ� �,�!��wjZ�U��6�pH8y��#OOe� c��5C��\�ɼ :�.���Q]$�lm����%��I�=� ���C��Р��#O�89Pk5����M����f�]_�cc
Screenshot :
Okay; I found why i get that weird error.
I think it is because Dreamweaver CS6.. I don't know excatly reason but when i type my code another php editor , function work fine..
Related
I am trying to integrate an ad package into my Smarty based site. I have been given the following PHP code that I need to add to my footer file. But due to it being Smarty I need to add the code instead to my php file so that it can be called/included in my Smarty template file. This was the code that I was given and that I need to include:
<?php if(function_exists('ad_footer')) ad_footer(); ?>
But in the php file I am not sure how to achieve this - I have got this example and wanted to know if it looked correct??
if(function_exists('ad_footer')) {
ob_start();
ad_footer();
$smarty->assign('ad_footer', ob_get_clean());
}
Does the above look the right way to do it?
Thanks in advance
I went ahead and created a test page to see if the above worked and it did so will stick with this code.
Can anyone tell me what is the difference between including the js script file in the following two ways,
I made this inside system plugin in joomla and included the js file inside "onAfterInitialise" function.
1)
<script type="text/javascript" src="<?php echo JURI::base(); ?>/plugins/system/test/script/script.js"></script>
This works fine and including the js file correctly, But when I logged-in from the backend the font size from userlisting and listing from other extensions gets enlarged.This is not the issue in my js script.
2)
$document->addScript(JURI::root(). "plugins/system/test/script/script.js");
This works fine without any issues.
Can anyone explain what goes behind this.
Using the second method is simply using Joomla coding standards and adds your script in between the <head> tags.
There isn't much difference except for where the script gets imported on the page.
JURI::base() and JURI::root() are both the same. They both define the root folder for your Joomla site. If you are unsure which one to use, I would recommend using method 2, as it's always good to get used to Joomla coding standards.
You can see the source of addScript() :) Basicly, if you use first method, your srcipt will be added in the same place you wrote the code. Second method will add link to a inner table in $document and will be 'rendered' at the
<head></head>
section at the end of page processing.
I am trying to find a way to write pure PHP in my articles with Joomla (currently using 1.5). The closest I got so far was to use a plugin called Sourcerer (see link)
The issue is that the PHP code is actually being rendered as HTML. When I write the below code via the Sourcerer editor:
<?php echo "Hello world"; ?>
This is what is being written to the article:
<span><</span>?php echo "Hello world"; ?<span>></span>
I am afraid that at some point this is going to break my PHP if I come up with more complex code. Also this makes the code hardly readable. Finally the issue with Sourcerer is that you can only insert new code, you can't edit what you previously added.
Does anybody know a way to write pure PHP into articles?
I would like to insist on the fact that it has to be within articles. I already found a way to do it in modules or components, for instance with Jumi.
I have used Sourcerer a couple of times and it does allow one to insert PHP snippets into articles without issues. If your php is being rendered as html, it sounds like the php isn't getting parsed as php - first thing is to make sure that the sourcerer plugin is indeed enabled so it can allow your php scripts to get parsed. (check plugin enabled status here: extensions->plugin manager->sourcerer).
Also, use the sourcerer ("Insert Code") button at the bottom of your WYSIWYG editor when adding your PHP scripts - it keeps the formatting/syntax highlighting and ensures that it is escaped properly with the {source} {/source} tags.
An update, I have the same issue with joomla 3.x, sourcerer, I have tried tinymice, JCKEdidor and JCEEditor. I have now given up with this method.
To insert php code into an article I have used a php include file and all the html is echoed inside this php include file. The php file is then referenced from within the Article Editor.
Those more proficient than me with joomla will no doubt do this correctly using a module or the like.
You can try another plugin called Direct PHP. It's nice and simple to use. Just download and install it and make sure it is enable. After this start writing your php code in joomla article.
Example:
<?php
echo "Hello World!";
?>
it supports all most every PHP functions and you can filter the functions what you don't need it from its settings.
Here is the link for the download.
Download & import plugin sourcerer https://extensions.joomla.org/extension/sourcerer/
{source} [[?php echo "Hello world"; ?]] {/source}
use this. It fine for me.
Apologize me if the question is unclear.
I'm a total newbie php user and I have this script that I want to edit.
The script have uses .tpl for the theme.
In the memberprofile.tpl there is the first name element $profilearray[0].firstname I want to add the result of this element also in another .tpl file called docs.tpl
I tried copying and pasting `$profilearray[0].firstname in docs.tpl but it did not work.
I noticed that docs.tpl uses its own $docsarray[0].xxx
So guys any idea how to do this? because there are some information in the member profile that I would like to add them inside the docs page.
I tried playing with mysql but I don't know how to use the same element firstname for both memberprofile and docs tables
I'm sure there is an easy way to do it.
Here's the full code from memberprofile.tpland I want to show some of these info in that theme docs.tpl
<p class="gray">
{$lang112}: <b>{$profilearray[0].firstname} {$profilearray[0].lastname}</b><br>
{$lang130}: <b>{$profilearray[0].birthday}</b><br>
{$lang134}: <b>{if $profilearray[0].gender eq "1"}Male{elseif $profilearray[0].gender eq "0"}Female{/if}</b><br>
{$lang140}: <b>{$profilearray[0].city}</b> <br>
{$lang139}: <b>{$profilearray[0].country}</b> <br>
{$lang113}: <b>{insert name=get_stripped_phrase value=a assign=pdesc details=$profilearray[0].description}{$pdesc}</b> <br>
{$lang259}: <b>{$profilearray[0].url|stripslashes|truncate:20:"...":true}</b> <br>
{$lang260}: <b>{insert name=get_time_to_days_ago value=var time=$profilearray[0].lastlogin}</b> <br>
{$lang261}: <b>{insert name=get_time_to_days_ago value=var time=$profilearray[0].addtime}</b>
</p>
Smarty has a tag you can google for called {include} that will do what you want. http://www.smarty.net/docsv2/en/language.function.include.tpl Use that tag on your docs.tpl file and you will be fine.
$profilearray
in your example is assigned to smarty template before the template is called in some fashion simmilar to this
$smarty->assign('profilearray',$somearray);
you'll need to find what is setting that in your first file then make sure that is included in your second template call
but you should certainly read the smarty documentation to understand what you are trying to do.
To step back for a moment... There are two parts to all this. The first part is the PHP code which actually takes user input, queries the database, processes the data, etc. The second part is the TPL file. As much as possible, the TPL file should only be concerned with presentation, not with data-processing, data-cross-referencing, etc.
All that database-reading and cross-referencing should happen inside a plain PHP file, not inside the TPL.
In order to add "Author information" to the "Documents List" (or whatever you call docs.tpl) page, you need to find the PHP code which pulls up the list of documents. Find the PHP code where it says something like:
$smarty->assign('docsarray',$document_list);
Now what you want to do is pass more information to the smarty template (TPL file) so that it can display it. Something like:
for($document_list as $index => $doc){
$owner = $doc['owner']; // Get the owner of the document
$profile = getProfile($owner); // Create one of the same things that go into $profilearray elsewhere
$document_list[$index]['profile'] = $profile; // Modify original array
}
$smarty->assign('docsarray',$document_list);
Then go into docs.tpl and find where it displays information about each document, and add smarty template code to read from the new per-document information you added. (Check the Smarty reference page for details.)
For example, if docs.tpl shows a table of documents, you might add a new column that shows the author's first/last name:
<tr>
<td>{$docsarray[$index].title}</td>
<td>{$docsarray[$index].created_date}</td>
<!-- Next line is new -->
<td>{$docsarray[$index].profile.firstname} {$docsarray[$index].profile.lastname}</td>
</tr>
If you want something that looks exactly like the "profile box", you can do that too. In fact, using {include} you can create profilebox.tpl and use it in both places to reduce redundant code.
I am using a framework called qcodo (which forked as qcubed) and is a PHP framework.
I want to do a very simple popup using the Facebox jquery plugin.
When someone clicks on the link and shown below in line 47.
Here is the file: http://github.com/allyforce/AF-upload/blob/master/Templates/profile_activity.tpl.php
<a href="complete_profile_popup.php?allyId=<?= $this->objAllyUser->Id?>" rel="facebox" title="Complete Profile" >Invite as Ally</a><br />
The Facebook installation worked fine, tested it just opening plain html and php files.
I just want to be able to render a working page within the Facebox pop-up.
But the current error is that it cannot recognize the method, even though it appears it has been defined.
UPDATE: Per one suggestion, used iFrame, but still getting nothing:
You should print the error you get. I will try to guess: have you declared your method as public? In the template you can access only public properties and methods. This is a very common mistake.
This issue/topic is being discussed in depth at http://www.qcodo.com/forums/forum.php/3/4007/