Joomla.it Forum
Non solo Joomla... => Sviluppo => : openthem 13 Nov 2009, 20:04:21
-
Ciao Ragazzi, ormai sono giorni che provo a creare una rotazione programmata di moduli, ma proprio non riesco da solo. Purtroppo esiste una sola scarna guida sul sito del produttore che non è per niente di aiuto... Aiuto!!
Devo fare il sito per una emittente radiofonica e questo modulo fa proprio al caso mio!
Oltre le normali opzioni (Cache, Tempo cache, Debug, Suffisso classe CSS modulo),
il modulo permette di settare lo "Start date/time(freeform)" e l'"End date/time" e la "Time Zone"
fino a qui tutto ok,
i problemi arrivano all'interazione dei settaggi:
- Auto-enable included modules? (pg 2)
- Available modules (pg 2)
- Quick module position or id include (pg 3)
- PHP (pg 3)
quest'ultima presenta un'ampia text area dove inserire il codice ma.. non so proprio che scriverci!
sotto la text area c'è la voce "Aiuto" (pg 3-4-5) c'è scritto questo:
Create some PHP code to determine which module should be used. Once the script has decided which module or modules to display, return the module id or module position name, a comma-separated list of module ids (and/or module position names) as a string, or an array of module ids and/or module position names. For more help and recipes, see the MetaMod home page. e.g.
if ( MM_NOT_LOGGED_IN ) return 65;
if ( MM_LOGGED_IN )
return "advert1";// all modules in "advert1" position
if ( MM_DAY_OF_WEEK == 1 )
return 67; // Monday = "1"
if ( MM_DAY_OF_MONTH == 1 )
return 68; // only show on 1st day of every month
if ( MM_MONTH == 5 )
return 69; // only show during month of May
if ( MM_YEAR == 2010 )
return "70,user2"; // only show during year 2010
if ( MM_HOUR >= 9 && MM_HOUR < 17 )
return 71; // 9AM-4:59:59PM daily
if ( MM_TIME >= 93010 && MM_TIME <= 171500)
return 72; // 09:30:10 to 17:15:00 daily
if ( MM_DATE >= 20090101 && MM_DATE <= 20090723)
return 73; // 1 Jan 2009 to 23 July 2009
if ( $fromCountryId == "US" ) return 55;
if ( $fromCountryId == "GB" ) return "55,56,57";
if ( $fromCountryId == "NL" ) return array(58,59,73);
if ( $fromCountryName == "New Zealand" ) return "user1";
You have access to the following PHP variables:
* $fromCountryId - the upper-case 2-letter ISO country code (e.g. GB, US, FR, DE)
* $fromCountryName - the official ISO country name
* $geoip - if you have enabled GeoLiteCity or GeoIPCity, a record containing the following items:
o $geoip->country_name - full country name, as above
o $geoip->country_code - 2-letter ISO country code, as above
o $geoip->country_code3 - 3-letter ISO country code (e.g. GBR, USA, FRA, DEU)
o $geoip->region - 2-letter code. For US/Canada, ISO-3166-2 code for the state/province name, e.g. "GA" (Georgia, USA). Outside of the US and Canada, FIPS 10-4 code, e.g. "M9" (Staffordshire, UK)
o $geoip->city - full city name
o $geoip->postal_code - For US, Zipcodes, for Canada, postal codes. Available for about 56% of US GeoIP Records. More info.
o $geoip->latitude
o $geoip->longitude
o $geoip->dma_code - 3-digit DMA/Metro code (US only)
o $geoip->area_code - 3-digit telephone prefix (US Only)
* $Itemid - the Itemid of the main component on the page
* $option - the option of the main component on the page (e.g. com content)
* $view - the view of the main component on the page (e.g. "article")
* $id - the id of the item in the main component on the page (e.g. "24:content-layouts")
* $db - in case you want to query the database for anything (for experts!)
* $language - a lower-case language code. By default this returns the default language of the web visitor’s browser, but can alternatively return the language code of the Joomla front-end, or intelligently find the best match between a user’s browser languages and a list of languages that you provide. Typical language strings returned include: en, en-gb, en-us, fr, de and many others.
* $language_code - the 2-letter language code without region (lower case) e.g. "en"
* $language_region - if it exists, the 2-letter region code (lower case). e.g. if $language == "en-us", $language_code == "en" and $language_region == "us". Having them in separate variables like this makes it easier to put into MetaMod rules.
* $user - information about the user, if they are logged in....
o $user->id - if 0, the user is not logged in
o $user->name
o $user->username
o $user->email
o $user->usertype - e.g. "" or "Public Frontend"=not logged in (test for both), otherwise "Registered", "Author", "Editor", "Publisher", "Manager", "Administrator" or "Super Administrator"
o $user->registerDate - e.g. "2007-05-17 01:25:52"
o $user->lastvisitDate - e.g. "2007-11-02 18:51:29"
Note: $fromCountryName and $fromCountryId will only be available if you have one of the "Enable GeoIP" options selected above, and if you have one of the GeoLite Country, GeoIP Country, GeoLiteCity or GeoIPCity databases installed (see Maxmind, direct GeoLite Country download, or direct GeoLite City download)
(http://i.imagehost.org/t/0581/metamod_pg1.jpg) (http://i.imagehost.org/view/0581/metamod_pg1)
(http://a.imagehost.org/t/0458/metamod_pg2.jpg) (http://a.imagehost.org/view/0458/metamod_pg2)
(http://a.imagehost.org/t/0295/metamod_pg3.jpg) (http://a.imagehost.org/view/0295/metamod_pg3)
(http://i.imagehost.org/t/0270/metamod_pg4.jpg) (http://i.imagehost.org/view/0270/metamod_pg4)
(http://a.imagehost.org/t/0302/metamod_pg5.jpg) (http://a.imagehost.org/view/0302/metamod_pg5)
-
devo solo impostarlo in modo tale che per esempio mercoledi mi visualizza il modulo x...
sul sito ho trovato questa guida http://www.metamodpro.com/support/control-module-parameters
ma non riesco ugualmente..
nella php text area ho scritto:
$changes->mod(129)
if ( MM_ DAY_OF_WEEK == 3 )
return 129;
mi visualizza il modulo ma oggi è domenica mentre dovrebbe visualizzarlo solo il mercoledi! inoltre mi riporta questo errore:ù
Parse error: syntax error, unexpected T_IF in /web/htdocs/www.radioxxxxxxx.com/home/modules/mod_metamod/helper.php(523) : eval()'d code on line 2
dove sbaglio?????
-
hai risolto poi? io ho appena usato questo modulo e ho risolto i miei problemi
-
Credo che tu per risolvere devi togliere la prima riga dal tuo codice, cioè
$changes->mod(129)
.
Questa istruzione è usata per cambiare qualche parametro del modulo con id 129. E credo che l'errore che ti da sia dovuto al fatto che al suo interno non si deve mettere un if