Hello,
I am trying to get Google ads to show up in the Phoca display box for gallery images. Thus, when someone goes into a gallery, clicks an image, a google ad would disply in that image box that displays the image content.
I have read your tutorial on how to do this here:
https://www.phoca.cz/documents/45-phoca- ... ca-gallery
However, I am having issues with this. The tutorial gives this example of code:
// PHOCA ADS EDIT - - - - - - - - - -
$adsRenderer = $document->loadRenderer('module');
$adsOutput = '';
$adsPosition = JModuleHelper::getModules('phocaads');
if (isset($adsPosition[0])) {
$paramsM = new JParameter( $adsPosition[0]->params );
if (isset($adsPosition[0]->module) && $adsPosition[0]->module =='mod_phoca_google_adsense' && isset($adsPosition[0]->params)) {
$adsense_code = $paramsM->get( 'adsense_code','');
$ip_block_list = $paramsM->get( 'ip_block_list','');
$alternate_content = $paramsM->get( 'alternate_content','');
$module_css_style = $paramsM->get( 'module_css_style','');
$ip_array = explode( ';', $ip_block_list );
$ipa = 1;//display
foreach ($ip_array as $value){
if ($_SERVER["REMOTE_ADDR"] == trim($value)) {
$ipa = 0;
}
}
if ($module_css_style) {
$adsOutput .= '<div style="'.$module_css_style.'">';
}
if ($ipa == 1){
$adsOutput .= $adsense_code;
} else {
$adsOutput .= $alternate_content;
}
if ($module_css_style) {
$adsOutput .= '</div>';
}
}
}
$this->assignRef( 'adsoutput', $adsOutput );
// PHOCA ADS EDIT - - - - - - - - - -
It says to paste this code after $params = &$mainframe->getParams(); inside the components/com_phocagallery/views/detail/view.html.php file. However, after searching throughout this file, I see no such code to paste the above code after. Also, when trying to paste the above code inside the php file I am getting a syntax error. I know it says to post the code without php start and end tags but I do not believe there are any start and end tags in the above code. Can you please paste me exactly what I am supposed to paste inside the php file?
Any help would be greatly appreciated. I really need to integrate google ads within gallery and hope to use phoca.
Google ads in Phoca Display box
- Jan
- Phoca Hero

- Posts: 49144
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Google ads in Phoca Display box
Hi, the customization is for obsolete versions, so for new versions other customization needs to be done, yes, for this the php skills are needed. Unfortunately I didn't do any such customization for new version so I cannot give any clue advice 
Jan
Jan
If you find Phoca extensions useful, please support the project
