Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

Image block rewrite

 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Blocks View previous topicPrinter friendly versionView next topic
Author Message
dpille

Beginner
Beginner


Joined: Apr 05, 2010
Posts: 1

PostPosted: Thu Dec 02, 2010 5:34 pm    Post subject: Image block rewrite Reply with quote

So my installation of phpnuke hated the canned image blocks, and I never liked the idea that I had to disable the gallery blocks to use the similar block site-wide. Anyway, I am a complete php newbie, and I'm posting this just in case someone else wants it to just work without having to brute-force program like I did.

The first section handles that "direct call" issue by assuming the file containing the block is block-Random_Image.php. Then, the block gets the direct random image page, strips off the <div...> and </div> tags that phpnuke won't play nice with, and places that in the block output between the <center> tags so it looks prettier.

The key things, I think, are that the @readfile that gallery2 suggests doesn't give you an editable string like flie_get_contents does. Also, I had a huge amount of difficulty remembering that there's a difference between a browser and a server- since my server doesn't recognize its own FQDN, I had to be struck by lightning to think of using localhost or a 192.168... address.

So to do newest image or any of the other out-of-the-box gallery2 image blocks, just get the corresponding link. Then look at the source for the page returned and change the substr($var, start-on-this-number-character-minus-one, stop-this-many-characters-from-the-end) syntax. No guarantees that this will place nice with image titles, etc, but I bet that's a lot easier to figure out than how far I've gotten already.

Hope somebody finds this useful.

<?php
if (eregi("block-Random_Image.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
$var = file_get_contents("http://path-to-gallery2-consider-'localhost'/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none");
$content = "<center>";
$content .= substr($var, 23, -7);
$content .= "</center>";
?>
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: Image block rewrite  

Back to top
anylinux

Beginner
Beginner


Joined: Dec 27, 2010
Posts: 2

PostPosted: Mon Dec 27, 2010 5:35 am    Post subject: Re: Image block rewrite Reply with quote

Hey people..Ia m new to this post so please give me some idea about this so even i can post my view here.
Regards,
php web development from india [anylinuxwork.com]
Back to top
Offline View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Blocks View previous topicPrinter friendly versionView next topic

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Dedicated ServersDomain NamesWeb HostingDomain Name RegistrationDedicated Web HostingWeb Design New YorkCompare VoIPseo packagesSEO CompanyNew York Yellow PagesFind LocationsVOIP Phone ServiceNeckermannOnline internetSEORestaurant Locator • Get great HP coupons from CouponSnapshot • Search for great dell coupons at CouponSnapshot.com.au • Graduation DressesAndroid TabletSEO IndiaBuy Phen375fuel filter

8th year online! 2003-2011
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia