Code Authors: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Code Authors Forum Index -> phpNuke Hints, Tips and Tweaks
Author Message
Guardian
Site Admin
Site Admin



Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic

PostPosted: Tue Jan 17, 2012 4:45 pm Share on Linked InShare on FacebookShare on Twitter Reply with quote

For a little while now (since upgrading to RN 2.5) , I noticed I was seeing a pair of double forward slashes up near the top right corner of the site. It only happened periodically, so just put it on my todo list of things to investigate.
Today I finally found the time (well an excuse to do something other than working on my latest module) and decided to investigate. I managed to eventually duplicate it, then viewed the generated source and found it was appearing somewhere in the ads() function for a flash advert in the header.
I tracked it down easily enough, I had accidentally put a double slash comment mark inside an echo'd bit of code instead of outside it. Here's the culprit (ads() function, mainfile.php
Code:


. ' // <img src="noflash.gif" width="200" height="100" alt="no flash" />'

As an aside, I'm not a huge fan of echoing stuff in this manner. It's probably perfectly 'correct' but to my warped sensibilities your basically concatonating lines of code (using the period as the seperator) which in my adled brain means "your joining stuff up" and if your joining stuff up the PHP interpreter must be seeing them as individual segments (how else can you join stuff if it's not seperate pieces?) so there must be some overhead there. I could be and probably am, incorrect but thats just how my mind works. I personally prefer to just open the echo with a single quote and just hit carriage return as many times as is required- the browser seems to see them as new lines and renders it almost exactly as it was written.

Moving on........
I fixed the code I broke and then noticed the darn flash image wasn't even showing up GRR.
So I had to revisit the entire function and do some more investigative work. Since if I remember correctly, I originally wrote that section of code for Flash images in an effort to get it compliant, I had a bit of a responsibility to see what was wrong with it.
As you might remember, EMBED isn't xhtml valid and that's what started the whole thing off......
Through my readings, it turns out that browser vendors, in the race to become superior to their competitors have sort of forgotten about built in prompts regarding Flash plug-ins and/or Flash compatibility. I'm not actually too worried about that, I think Flash is archaic, proprietory and a general PITA. However, having Flash on your site and not knowing it isn't being displayed in your browser IS kind of a big deal - especially if you were doing something stupid like relying on the the Flash part to 'fill' a section of a theme as it would destroy the whole layout.

Here's some new code that's valid and also takes into consideration IE's quirks as well as a fall-through if your browser doesn't actually have flash capability.
Code:


$ads = '<div class="text-center">'
        .'<!--[if !IE]> -->'
        .'<object type="application/x-shockwave-flash" data="'.$imagurl.'" name="'.$bid.'" width="'.$ad_width.'" height="'.$ad_height.'">'
        .'<!-- <![endif]-->'
        .'<!--[if IE]>'
        .'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'
        .' name="'.$bid.'" width="'.$ad_width.'" height="'.$ad_height.'">'
        .'<param name="movie" value="'.$img_url.'" />'
        .'<!--><!--dgx-->'
        .'<param name="loop" value="true" />'
        .'<param name="menu" value="false" />'
        .'<p><b>Your browser says it support Flash <br />
            but doesn\'t seem to have the correct plug-in or it\'s missing.</p>'
        .'</object>'
        .'<!-- <![endif]--></div>;

Of course it would be better to display a fixed size image instead of text for the fall-through but that's for you to sort out Wink

_________________
TPD 
View user's profile Send private message Send e-mail Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic

PostPosted: Sat Jan 21, 2012 3:24 pm Share on Linked InShare on FacebookShare on Twitter Reply with quote

Just realised the double slashes was actually a bug in RN 2.5 not a bad file merge by me so I've posted at Ravens site for the benefit of others.

_________________
TPD 
View user's profile Send private message Send e-mail Visit poster's website
Palbin
Newbie
Newbie



Joined: Nov 20, 2008
Posts: 55

PostPosted: Sat Jan 28, 2012 10:32 pm Share on Linked InShare on FacebookShare on Twitter Reply with quote

You are missing a ' after the closing div to "close" the string.
 
View user's profile Send private message Send e-mail
Palbin
Newbie
Newbie



Joined: Nov 20, 2008
Posts: 55

PostPosted: Sat Jan 28, 2012 10:41 pm Share on Linked InShare on FacebookShare on Twitter Reply with quote

I have added this code into the 2.5 branch of RN.
 
View user's profile Send private message Send e-mail
Guardian
Site Admin
Site Admin



Joined: Jan 06, 2006
Posts: 4469
Location: Vsetin, Czech Republic

PostPosted: Sat Jan 28, 2012 10:52 pm Share on Linked InShare on FacebookShare on Twitter Reply with quote

Yeah sorry, the forum mangled it and I had to re-add the last half a dozen lines or so from memory as I'd closed my IDE. I think I was also having a "typo's R Us" day as well lol.
The original RN 2.5 code (with the corrected comment slashes) works now after a Firefox update but it was really weird at the time when I was scratching my head wondering why one of my Flash banners wasn't showing up lol.
I'll be really happy to see Flash consigned to the dustbin.

_________________
TPD 
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Code Authors Forum Index -> phpNuke Hints, Tips and Tweaks

View next topic
View previous topic
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
You cannot attach files in this forum
You cannot download files in this forum

 
Forums ©
linear-bunch