Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hi,
just gave MetaMod a try, because I hope it will fit my needs.
I wanted to make a module appear for a specified period, entered some code from the recipies and the jom_genius-documentation and get a parse error as a result. I´m pretty sure there´s an error in my code, but I just don´t get an idea, where to look...would the very thankful for help
Using local installation with xampplite...
The code I entered:
Code:
$changes->mod(47)
->if ( $core_genius->inTimeSpan ( "jan 3 14:30:30 - mar 3 13:30:30" ) )
return 47;
The error i got:
Code:
Parse error: parse error in D:\xampplite\htdocs\apo\modules\mod_metamod\helper.php(539) : eval()'d code on line 3
Thanks,
*el*
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hi el,
hmmm... that kind of parse error just means that the PHP code didn't make sense and had a syntax error. The PHP you quoted is definitely odd... if you copied and pasted that directly from a page on the site, could you tell me where it was so I can fix it? Thanks
Anyway, you probably mean something like this instead: (just cut out your first line)
if ( $core_genius->inTimeSpan ( "jan 3 14:30:30 - mar 3 13:30:30" ) )
return 47;
Cheers,
Stephen
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hey Stephan,
thank you for this very fast support!
When I tried to figure out how to set up the php, I followed these instructions:
http://www.metamodpro.com/metamod/contr … parameters
(How MetaMod controls other modules parameters)
From then on you can stack on as many parameter changes as you like, each prepended with "->".
and
http://www.metamodpro.com/metamod/recip … time-rules (for the time rules).
If I get you right, the code should be like this?
Code:
$changes->mod(47)
if ( $core_genius->inTimeSpan ( "jan 3 14:30:30 - mar 3 13:30:30" ) )
if ( $core_genius->inTimeSpan ( "jun 14 21:23:40 - sep 1 23:59:59" ) )
return 47;
So no "->" needed in front of the variables? Because I need more than just one period for the module to appear - means I just put the next "if..." in a new line and finish after all variables for this module with return xx; - I´ll try this
Thank you very much!
Cheerio
*Thilo*
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
The "How MetaMod controls other modules parameters" thing is a very specific function that can allow you to... control module parameters It's not necessary to use that if you just want to include or not include a module on a page. So please ignore the instructions about the $changes mechanism, and remove the line in your code "$changes->mod(47)" as it is causing an error.
To stack more than one time period, do it this way, with "or":
if ( $core_genius->inTimeSpan ( "jan 3 14:30:30 - mar 3 13:30:30" )
or $core_genius->inTimeSpan ( "jun 14 21:23:40 - sep 1 23:59:59" ) )
return 47;
That's all you need.
Cheers,
Stephen
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hi
I try Metamod before purchasing Metamodpro that would be very very usefull !
And... and have a problem ! "Parse error..." in other (simple ?!) case
I've search here before posting but not found and post here that's seems nearby.
With the code :
Code:
if ( $geoip->region == FR,B3,"Midi-Pyrenees" ) return 181;
I obtain :
Parse error: syntax error, unexpected ',' in /homez.313/publicom/www/modules/mod_metamod/helper.php(539) : eval()'d code on line 1
I'm not dev nor php specialist and don't see where is my mistake !...
A moment I've thought that would be a problem with T3 framework but seems not ( topic :
http://www.metamodpro.com/forums/topic?id=452.
Is there somebody to help me ?
Thanks in advance
Henri
Edit : (sorry !) Joomla 1.5.23/GK template Memovie T3 framework
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hi,
this code is not valid PHP:
if ( $geoip->region == FR,B3,"Midi-Pyrenees" ) return 181;
I think you're probably looking for this:
if ($geoip->country_code == "FR" and $geoip->region == "B3") return 181;
I guess you looked at the table on this page: http://www.maxmind.com/app/fips10_4 and just took the whole row. The region code is actually just the middle value, and you also need to check the country code (as I did above), since you'll find region "B3" in more than one country.
Hope that makes sense,
Stephen
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hello Stephen
I've tried the code indicated but not works...
In my test, I want to display (permanently) in a same position P :
- a module 261 for visitors from country France (FR), Region Midi-Pyrénées (B3)
- a module 262 for visitors from country France, Region Corse (A5)
- a module C for visitors from others countries/regions (sub-countries)
All rules are the Metamod module's default except those below, the modules to show being in menu affectation "none" as indicated
1-First test:
I've put the code with "simple module position or ID to include" empty
Code:
if ($geoip->country_code == "FR" and $geoip->region == "B3") return 261;
if ($geoip->country_code == "FR" and $geoip->region == "A5") return 262;
Result (visitor of in Midi-Pyrénées = me): none module displayed
2-Second test:
I've put the same code with "simple module position or ID to include" including: "261,262"
Code:
if ($geoip->country_code == "FR" and $geoip->region == "B3") return 261;
if ($geoip->country_code == "FR" and $geoip->region == "A5") return 262;
Result (visitor of in Midi-Pyrénées = me): both modules 261 and 262 displayed simultaneously.
And I don't know how to insert available code to the condition "a module C for visitors from others countries/regions (sub-countries)"
Can you tell me where is(are) my new error(s)? An example?
These parameters settings seem to be very basic (even for a newbie as me) and I'm now very impatient to use MetamodPro with such settings.
Thanks in advance
Henri
PS: Metamod version = 2.6 - Joomla! 1.5.23
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hi Henri,
1 - if you are using the PHP section of MetaMod, then don't use the "Quick module id/position include" box. This usually results in ALL users seeing the modules in that box.
2 - I wonder if your IP address is actually getting detected correctly? Try turning on MetaMod's debug mode and see what it reports on the front end, with the GeoLiteCity database active. Perhaps it's putting you in a different region, or can't detect it at all.
Hope that helps,
Stephen
Re: Parse Error: ...\mod_metamod\helper.php(539) : eval()'d code on line 3
Hello Stephen
Thanks for response!
But the problem is not solved=(...
I had (effectively) an IP adress problem (it was recognized as "unknown"): the provider has solved today
But testing again Metamod the problem remains
I've turned Metamod on debug mode and here are the elements:
- I'm in France , region "Midi-Pyrénées" (B3) near city of Toulouse, with IP as :
AToulouse-652-1-72-167.w2-6.abo.wanadoo.fr
Proxy : no Proxy (or Anonymous Proxy)
- Metamod : position P + menu item (affectation) => A + "all users" + "Quick module id/position include" box=empty +
PHP box = "if ($geoip->country_code == "FR" and $geoip->region == "B3") return 261;"
- Module 261 (AL Eventlist scroller) : position P + menu item (affectation) => none
> result : none (module not displayed.
> debug infos :
Page d'identification
Le code PHP ci-dessous peut être utilisé par Metamod pour identifier la page que vous visualisez. Pour une aide à cette utilisation, cliquez ici.
if (
$option == 'com_eventlist'
and $view == 'categoryevents'
and $id == '3'
and $Itemid == '67'
) return XXX; /* remplacer XXX par l'ID du module ou par sa position pour le faire apparaître */
MetaMod debug info:
Module ID: 191
$option: com_eventlist
$view: categoryevents
$id: 3
$Itemid: 67
$timezone: Europe/Paris
$language: fr-fr
$language_code: fr
$language_region: fr
Pays: FR
Nom du pays: France
Country Code 2: FRA
Region:
City:
Postal Code:
Latitude: 46
Longitude: 2
DMA Code:
Area Code:
Modules inclus:
The field "Region" appears empty...
I've tried with the only GeoIP country :
- with PHP code : "if ($geoip->country_code == "GB") return 261;" => none module: ok (I've not controlled with British but I can)
with PHP code : "if ($geoip->country_code == "FR") return 261;" => ok module displayed!
I really don't understand what happens!
Can you help me to solve?
I really need to use extension as Metamod (e.g. Metamod Pro) with GeoIP Regions (and cities)...
If necessary, no problem for a commercial help: tell me how. If you want I can also send admin access.
Thanks in advance
Henri
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7639
- Newest User:
- corwin8669
- Members Online:
- 1
- Guests Online:
- 133
- Online:
- corwin8669
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked