is PHP allowed on the pages to be inserted

andre1122
@andre1122
10 years ago
21 posts
is php allowed to be inserted in Jamroom 5 for ads on all pages.
Below is the code...how will I go about inserting the code on different pages to relate to different ads or is best with javascript source if I have that code




In Grouping :

<?php /* Home Page Right FB 1 */ @readfile('http://onlyopera.com/mysa/mysa_output.php?r='.$_SERVER['REMOTE_ADDR'].'&h='.urlencode($_SERVER['HTTP_HOST']).'&rf='.urlencode($_SERVER['HTTP_REFERER']).'&ua='.urlencode($_SERVER['HTTP_USER_AGENT']).'&show_ad_group=7'); ?>







please let me know if it cna be done..
Thank you
updated by @andre1122: 05/10/14 02:12:01PM
michael
@michael
10 years ago
7,714 posts
You cant use that in a template file.

If you want to use it in a template file, you need to wrap it in a function

template file:
{anCustom_readfile}

Then make a module called:
/modules/anCustom

and create this function in the include.php file:
function smarty_function_anCustom_readfile($params, &$smarty)
{ //you can put php in here //so $output = @readfile('http://onlyopera.com/mysa/mysa_output.php?r='.$_SERVER['REMOTE_ADDR'].'&h='.urlencode($_SERVER['HTTP_HOST']).'&rf='.urlencode($_SERVER['HTTP_REFERER']).'&ua='.urlencode($_SERVER['HTTP_USER_AGENT']).'&show_ad_group=7'); ?> return $output }

There is a video here:

"Add a section to the profiles (Jamroom CMS Development) "
Add a section to the profiles (Jamroom CMS Development)

That outlines how to create a REAL simple module that you could use as a base for this.
brian
@brian
10 years ago
10,148 posts
You can also just wrap the code in PHP tags:

http://www.smarty.net/docs/en/language.function.php.tpl

{php}
your php code goes here
{/php}

I tell you looking at that code though, bringing it in that way and trusting $_SERVER like that - make sure mysa_output.php is secure and from a developer you trust.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
andre1122
@andre1122
10 years ago
21 posts
Hi Brian, Now I do trust the developer of Mysa, However If I can prevent using Php and use JavaScript it will be better.

The problem with the javascript is that it interferes with Core ajax and distorts Images on Home page (Slider and Newest Members

In slider it adds the "pause " symbol and in newest members : the images doesn't get displayed. So somewhere the Java Input is interfering although it does load the ads. How to prevent the JS from interfering?
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
These are probably not problems with the javascript of either Jamroom or your mysa script. Javascript generally doesn't interfere, it progressively enhances.

Are you sure you understand what you are doing? Are you sure you are not breaking it?


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
andre1122
@andre1122
10 years ago
21 posts
I have a problem to add the JS here - the moment I ad it - it display the add it is suppose to call :( I know the JS works because it does what it needs to do and it does that on the template as well, but distorts the slider - It keeps on adding the "pause" Symbol, and prevent the images to load in newest members.

I do not know how to prevent this interference
andre1122
@andre1122
10 years ago
21 posts
I try to add the JS in parts but the first part will not show here - doesn't matter how I try to break it up :(
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
Make sure you understand your eternal javascript before you try to add it to jamroom (I am assuming you understand Jamroom).


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
andre1122
@andre1122
10 years ago
21 posts
I have a little understanding of Jamroom, I have one person who took pity on me and without him Only Opera would still be a pipe dream. He has spend Hours and days to help me built Only Opera. But we both have a problem to get the JS to work without interfering. So frustrating I can not add the code here: I am certain it is something so simple we are overlooking :(
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
If you don't understand either Jamroom or the javascript you are trying to add to jamroom, I can understand why you are feeling frustrated.

It's not surprising that you cannot add code that you don't understand to other code that you don't understand. Same thing here. Pretty much universal experience imo.

You need to develop some degree of understanding of jamroom, AND your external javascript. Otherwise your question is just another "How do I turn this brick into a car?"

If you can't make a module similar to what Michael outlined above, you can either get someone else to do it for you, or develop some understanding and then do it yourself.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

Tags