Login
Nome utente:

Password:

Ricorda



Recupero password

Registrati!
Navigazione
Utenti Online
20 utente(i) online
(1 utente(i) in Tutorial)

Iscritti: 0
Ospiti: 20

altro...
Tutorial :: Sviluppo e Hack :: Hack per Xoops 2.0.x

La foto del giorno? Semplice con questo hack!


La foto del giorno? Semplice con questo hack!
slyss
Con una semplice funzione è possibile visualizzare un blocco PHP contenente una foto impostando certi parametri personalizzabili! Tutto è molto semplice e richiede una galleria myalbum.
Profilo Autore: slyss
Ciao a tutti...

mi arrivano privatamente molte richieste di aiuto per creare blocchi che visualizzino immagini presenti nelle gallerie myalbum. Molte volte mi è stato chiesto di poter visualizzare una foto random, oppure l'ultima foto inserita dagli utente, ecc... Bene, con questa mia funzione è possibile inserire infiniti blocchi secondo le più diverse necessità.

INIZIAMO:

aprite il file root/include/functions.php ed alla fine, prima del tag di chiusura php inserite questa funzione:

/****** hack by www.stefanosilvestrini.com *****/
function getPicGallery($myalbumNum$cid$random) {
    global 
$xoopsConfig;
    
$db =& Database::getInstance();
    
$myalbumNum trim($myalbumNum);
    if(
$random != 1$sql "SELECT s.lid AS lid, s.ext AS ext FROM ".$db->prefix('myalbum'.$myalbumNum.'_photos')." s, ".$db->prefix('myalbum'.$myalbumNum.'_cat')." t WHERE s.cid = t.cid AND s.cid = ".$cid." ORDER BY s.lid DESC LIMIT 1";
        else 
$sql "SELECT s.lid AS lid, s.ext AS ext FROM ".$db->prefix('myalbum'.$myalbumNum.'_photos')." s, ".$db->prefix('myalbum'.$myalbumNum.'_cat')." t WHERE s.cid = t.cid AND s.cid = ".$cid." ORDER BY RAND() LIMIT 1";
    
$result $db->query($sql);
    
$myrow $db->fetchArray($result);
    
$object =     "<div style='text-align: center;'>"
                
."<a href='".XOOPS_URL."/modules/myalbum".$myalbumNum."/photo.php?lid=".$myrow['lid']."'>"
                
."<img src='".XOOPS_URL."/uploads/thumbs".$myalbumNum."/".$myrow['lid'].".".$myrow['ext']."' align='center' hspace='3' vspace='3' width='100px' />"
                
."</a>"
                
."</div>";
    return 
$object;
}


chiudete e salvate.

A questo punto è tutto molto semplice!

Create un blocco PHP e richiamate la funzione in questo modo:

echo getPicGallery('''1''1');


dove i paramentri sono nell'ordine:

- numero Myalbum (lasciare vuoto se è myalbum di base)
- cid = categoria relativa alla foto
- ordine: 1 = foto random; 0 = ultima foto inserita

Come è facile immaginare, questo hack può essere utilizzato il migliaia di modi differenti... Io per esempio lo uso per visualizzare le ultime foto inserite dagli utenti, ecc..

Spero vi sia utile

a presto!!!

sly :ok

ps: il risultato della chiamata della funzione

echo getPicGallery('''1''1');


la potete vedere nel blocco Function Block by slyss su http://www.stefanosilvestrini.com/lab/
<< Justin Erenkrantz, Presidente della Apache Software Foundation, è entrato ufficialmente nella XOOPS Advisory Board
API: RSS | RDF | ATOM
Copyright© slyss & Xoops Italia
I commenti sono di proprietà degli autori. Si declina ogni responsibilità sul loro contenuto.

Autore Contenuto
Anonymous
Data di invio: 28/6/2012 14:16  Aggiornato: 28/6/2012 14:16
 simple short prom dresses atria
Besides these, jewelries have been the single of the many critical ways to accessorize your spousal dresses. Choosing the right valuables depends on multiform factors similar to your personal taste, Sell long length long sleeve halter plus size gorgeous ball gown [url=http://www.avicadress.net/]formal dress and gowns[/url] polka character of marriage robe as well as the marriage theme. A prolonged match necklace, Find Justin Alexander by tea length retro style wedding gowns half sleeve cuffed busty stylish princess [url=http://www.avicadress.net/Short-Prom-Dresses.html]prom dresses 2012 short[/url] with purple in fresno ca thick bangles, long sleeve jewel engaging princess [url=http://www.avicadress.net/]halter wedding dresses[/url] with burgundy candelabrum earrings or solid earrings, pearls scored equally to the necklace long sleeve cowl precious a line [url=http://www.avicadress.net/]casual wedding dresses[/url] with hourglass , rendezvous ring have been only the little of the ways to supplement character quotient to your spousal wear with the assistance of jewelries.

Autore Contenuto
Anonymous
Data di invio: 28/6/2012 14:51  Aggiornato: 28/6/2012 14:51
 Re: simple short prom dresses atria
Besides these, jewelries have been the single of the many critical ways to accessorize your spousal dresses. Choosing the right valuables depends on multiform factors similar to your personal taste, Sell long length long sleeve halter plus size gorgeous ball gown formal dress and gowns polka character of marriage robe as well as the marriage theme. A prolonged match necklace, Find Justin Alexander by tea length retro style wedding gowns half sleeve cuffed busty stylish princess prom dresses 2012 short with purple in fresno ca thick bangles, long sleeve jewel engaging princess halter wedding dresses with burgundy candelabrum earrings or solid earrings, pearls scored equally to the necklace long sleeve cowl precious a line casual wedding dresses with hourglass , rendezvous ring have been only the little of the ways to supplement character quotient to your spousal wear with the assistance of jewelries.

Autore Contenuto
Anonymous
Data di invio: 17/7/2012 3:02  Aggiornato: 17/7/2012 3:02
 Re: La foto del giorno? Semplice con questo hack!
conceived alarm clocks and because the technologies innovative gentleman realized the importance of spot working with an emphasis on compactness. This is actually the situations which is attributable to the arrival pertaining to preliminary observe. It ended up getting way again in 1511 if Cindy Henlein Visualizza immagine originale , fake rolex watches fake rolex watches a different German born clockmaker designed a tiny 'clock' which will be overly enthusiastic with purse or maybe pocket. The gizmo ended up staying just a produce to inform a while to your certain comfort seemed to be your perform that can distinguished the main difference. faked rolex faked rolex For many years and a long time the convention acquired significantly based mostly in quite a few nations around the world additionally teams until finally eventually enhancement of the strap to the streamlined confront which is able to gave start towards the main actually wristwatch replica mens watches replica mens watches breitling replica classic 19184 breitling replica classic 19184 philippe patek philippe patek audemars piguet royal oak offshore audemars piguet royal oak offshore . fake omega fake omega All

Autore Contenuto
Anonymous
Data di invio: 17/7/2012 3:03  Aggiornato: 17/7/2012 3:03
 Re: La foto del giorno? Semplice con questo hack!
cheap prom dress cheap prom dress consultation, it's best to inquire when they will personally be undertaking the 'shoot' around the real day of the marriage ceremony. dresses cocktail evening dresses cocktail evening mother groom wedding dresses mother groom wedding dresses In case you have picked an expert, it's doable they've many photographers functioning being a workforce. It is usually doable the portfolio you've got witnessed on the net belongs to some photographer who not will work for that crew or may very well be focusing on another thing on the marriage ceremony day. Consult properly and when attainable to view a recent portfolio with the photographer perhaps focusing on your aspiration marriage ceremony album. The amount does marriage ceremony photography price flower girl dress flower girl dress yellow maternity dress yellow maternity dress ? After you discover a photographer that satisfies your favorite type and inventiveness Visualizza immagine originale , dance costumes dresses dance costumes dresses your subsequent issue will include fitting this bundle into your spending budget white bridesmaid dresses white bridesmaid dresses . Off hand, wedding

Autore Contenuto
Anonymous
Data di invio: 4/8/2012 10:08  Aggiornato: 4/8/2012 10:08
 Re: La foto del giorno? Semplice con questo hack!
Should you will probably be content and bright wedding ceremony short cocktail dresses day - occur to us! Within the boxweddingdress on the internet masquerade prom dresses bridal stores you'll really feel the wedding dresses atmosphere in the wedding ball gowns major and most stunning evening dress vacation in my life, tune into the desired wave and feel the rush of inspiration. We are able to attempt on wedding dresses and liked to see catalogs of wedding and bridal dresses, dama dresses for quinceaneracautiously study you are interested in wedding ceremony gown picture, to check with and discuss all the details of our consultants. Then select your favorite model a wedding ceremony dress to get or tailoring.

Autore Contenuto
huff01
Data di invio: 5/9/2012 11:21  Aggiornato: 5/9/2012 11:21
Senior
Iscritto: 5/9/2012
Da:
Inviati: 164
 replica rolex
identified within the dial, winding crown and circumstance again of each registered Baume and Mercier look at to point that it follows the numerical divine proportion as established by Leonardo Da Vinci Breitling Aerospace watches Breitling Aerospace watches . The dimension in the look at is about forty five mm and also the width from the casing is about 34 swiss audemars piguet fake watch swiss audemars piguet fake watch fake cartier watches fake cartier watches . replica audemars piguet swiss watch replica audemars piguet swiss watch one mm fake watches fake watches . Although the enjoy is expressly created for gents replica audemars piguet swiss watch replica audemars piguet swiss watch armani swiss replica watches armani swiss replica watches , it is nonetheless good for girls to don also. It's also possible to have a individual edition for ladies that is certainly pretty much the identical dimension and form but with fifty two diamonds embedded in towards the bezel. This model continues to be specifically created for Center Japanese Ladies and arrives in two colours of white and pink. The womens edition can be a restricted edition with just a few parts currently being manufactured to purchase Visualizza immagine originale . What it is replia Armani Swiss replia Armani Swiss

Autore Contenuto
huff01
Data di invio: 12/9/2012 2:42  Aggiornato: 12/9/2012 2:42
Senior
Iscritto: 5/9/2012
Da:
Inviati: 164
 u boat replica watches
type of medical attention. This is frequently seen as being very complicated when attempting to reach an informed and successful consensus. Consumers that understand what to look for are frequently able to receive a great level of care replica aigner replica aigner Visualizza immagine originale . People often begin this process by reading consumer reviews. Discovering what other patients have to say about the facility helps people make an informed choice of which one to use. This becomes a major source of making sure this process is successfully completed. ebel replica ebel replica replica blancpain replica blancpain replica watches for sale replica watches for sale replica u boat watches replica u boat watches The best facility is also one that has an incredible staff. All staff members that are hired by the facility should be well trained and able to offer industry leading care. Make sure this is heavily focused in on at all times replica oris watches replica oris watches . Finally, the best hospital Las Vegas is known to offer a convenient location. breitling superocean heritage breitling superocean heritage
Sostieni XoopsItalia!
Ultimi Tutorial
Ultime Traduzioni
XOOPS ITALIA © 2002-2012 - Powered by XOOPS