Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Extensions / Support / my plugin doesnt work on live server

diablo
#1 2013-03-05 02:13


Members
Thanked: 5 times

<?php
 
/* ====================
[BEGIN_COT_EXT]
Hooks=global
Tags=index.tpl:{ARAMA}
Order=99
[END_COT_EXT]
==================== */

$fieldsresss = $db->query($sql = "SELECT field_variants FROM $db_extra_fields WHERE field_name='semt'");
$rowss = $fieldsresss->fetch();
$semt = $rowss['field_variants'];
$fieldsresss = $db->query($sql = "SELECT * FROM $db_extra_fields WHERE field_name='oda'");
$rowss = $fieldsresss->fetch();
$oda = $rowss['field_variants'];

$semtler = cot_selectbox('', 'semt', $semt, '', true, 'id=semt');
$odalar = cot_selectbox('', 'oda', $oda, '1+0,1+1,2+0,2+1,3+1,4+1,5+1,6+1,2+2,3+2,4+2,5+2,6+2,7+1,7+2', true, 'id=oda');
$emlak = cot_selectbox_structure('page', '', 'cate', '', true);
$fiyat = cot_inputbox('text', 'fiyat1', '250', 'id=fiyat1')." - ".cot_inputbox('text', 'fiyat2', '1500', 'id=fiyat2');
$referans = cot_inputbox('text', 'ref', '', 'id=referans');
$metre = cot_inputbox('text', 'metre1', '75', 'id=metre1')." - ".cot_inputbox('text', 'metre2', '300', 'id=metre2');
?>

this is my plugin for a custom search i use on my project. it shows input and selectboxes and works perfectly on my localhost. today i wanted to go live and im getting an error

Fatal error: Call to undefined function cot_selectbox() in /home/ppastelt/public_html/plugins/arama/arama.php on line 18

Edit: i solved the problem by adding cot_incfile to forms.php but i still wonder why it doesnt work on live but works on localhost

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."

This post was edited by diablo (2013-03-05 02:19, 1 years ago)
Trustmaster
#2 2013-03-05 05:23


Administrators
Thanked: 227 times

Edit: i solved the problem by adding cot_incfile to forms.php but i still wonder why it doesnt work on live but works on localhost

It happens because on localhost it has a different order of plugin execution. Some other plugin already includes forms.php befor this plugin on localhost but not on live server.

May the Source be with you!
tensh
#3 2013-03-05 07:59


Contributors
Thanked: 9 times

Oh, can you explain me this mechanic, Trustmaster? It's interesting!

Trustmaster
#4 2013-03-05 10:26


Administrators
Thanked: 227 times

This is simple. Hooks are just PHP includes as you know. And they have the Order property, but normally you use the default Order value. Hook handlers having the same Order value are executed in the order they were installed and you are likely to install plugins in a different order on different sites, or you might even use different sets of plugins. So to avoid such "surprises" you should always require the stuff you need explicity, or make sure something else requires it for you beforehand.

May the Source be with you!
tensh
#5 2013-03-05 12:34


Contributors
Thanked: 9 times

Thanks :) Simple yet I would not learn it so easily. :)