Jump to content

Gutspiller

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Gutspiller's Achievements

Member

Member (2/5)

0

Reputation

  1. Here is my current code. <?php echo " <script type=\"text/javascript\"> <!-- var containerID = \"advertise\"; var number = 16; var timerID = setInterval(\"CountdownTimer()\",1000); function CountdownTimer() { if(number > 1) { number--; ReplaceContentInContainer(containerID,number); } else { clearInterval(timerID); ReplaceContentInContainer(containerID,'<p class=\"downbutton\"><a href=\"download.php?shortURL=$filedrop->shortURL\" class=\"uploadbutton round-tl-br-xl green-matte\">Download</a></p>'); } } //--> </script> "; ?> This works in the page I have it on, but I am trying to instead of showing all that in the source, have it show something like <script type="text/javascript" src="dbutton.js"></script> The problem is that the php variable $filedrop->shortURL isn't being processed when I move it all over to its own js file. It writes out "$filedrop->shortURL" instead. I don't know much at all about javascript, other than looking at code and stumbling my way through it. Can somebody rewrite this code as to how I should insert it into my dbutton.js file to make it still work with that php variable? Thanks in advanced for any help you can offer me.
  2. Are you asking for me to give you specs and you'll write the code, or were you only pointing out that I think be php should be awesome automatically? I'll take the time to write it all down, if you are willing to help. I do have 1 question, does it take php a longer time to process or put more strain on the server, if you simply have code that is similar to this: blah blah code code that offers a spot of special characters I don't want blah blah code code that has spot for matches of things that should always be caps blah blah code etc. Is what I mean is, is there a longer execution time for a single php command that strips out special characters, versus making it so there's an "array" of sorts that simply lets me put in all the characters I don't want to be displayed?
  3. I have other code that cuts off at 47 characters. With things #8217; it ends up sometimes cutting it in between the code, when that happens, it leaves ugly squares in the line of text because the #8217; didn't get completed. I tried to get help on this problem here ( http://www.phpfreaks.com/forums/index.php?topic=336357.0 ), but for some reason, all the code recommendations didn't work in my code. Below is what I currently have. If someone could give me the code all together to replace the code below, that does all of the same stuff, maybe it would finally process without giving an error. I kinda gave up on that previous thread, since it never seemed to work right, but if someone wants to try and give me all one group of code that does the same stuff, I'll try it again. <? $nohtmltitle = strip_tags($row['title']); $newtitle = preg_replace('/[^a-zA-Z0-9\&;\,#.\-\$ ]/','',$nohtmltitle); $nocaptitle = preg_replace_callback( '/\b\p{Lu}{3,}\b/u', create_function( '$matches', 'return ucwords(strtolower($matches[0]));' ), $newtitle ); ?> I'm new to php, but I still can't believe there isn't a simple command that just cleans text up, so that it looks decent. I didn't think I was asking for so much to not want all caps, not want ugly characters, not have it cut off in the middle of a word, be limited to 47 characters, yet still be smart enough to leave abbreviations like EA, but changes things like inFAMOUS to Infamous.... I guess that's asking too much for just a quick command or short line of code, anyway give it ago if you can. Seeing special characters and broken code like mentioned above is annoying as ever.
  4. I'm very new to php. I have the following code: $nohtmltitle = strip_tags($row['title']); Yet, when I look at the processed code, I still get crap like this #8217; that represent characters. I either want to TRULY strip out all special characters that are processed with these types of short number codes, or I want them converted to be what they actually are. So that if $row['title'] is suppose to have ", then when I view the source, there are " and not something like #8217; Can somebody fix my code line above so that it works like this?
  5. Can I simply rename truncatestring to something else in all spots of this new code for it to work, or is it a direct php function that if renamed, php wouldn't know what to do with it?
  6. I only pasted your code once, here's my entire code for that section: <div class="<?=$template['classname']?>"> <h2> <? if ($template['permalink']){ ?><a href="<?=$template['permalink']?>" target="_new"><img src="<?=$template['favicon']?>" width="16" height="16" border="0" style="vertical-align:middle;" onerror="this.style.display='none'"/><? } ?> <? $newurl=parse_url($template['permalink']) ?> <?= str_replace ( array("www.",".com",".net",".org",".cc",".ru",".co.uk",".de",".us",".gov",".biz",".dk"), "", $newurl['host'] )?> <? if ($template['permalink']){ ?></a><? } ?> </h2> <div style="background-image:url('images/alternating.gif');background-repeat:repeat-x;"> <ul> <? foreach($template['rows'] as $row){ ?> <? $nohtmltitle = strip_tags($row['title']); $newtitle = preg_replace('/[^a-zA-Z0-9\&;"\,#.\-\$ ]/','',$nohtmltitle); $nocaptitle = preg_replace_callback( '/\b\p{Lu}{3,}\b/u', create_function( '$matches', 'return ucwords(strtolower($matches[0]));' ), $newtitle ); function truncateString($string, $length, $ellipse='...', $preserveLineBreaks=false) { if(!$preserveLineBreaks) { //Remove 1 or more line breaks with a single space $string = preg_replace("#(\r|\n)+#", " ", $string); } if (strlen($string) <= $length) { return $string; } return trim(array_shift(explode("\f", wordwrap($string, $length, "\f")))) . $ellipse; } $nocaptitle = truncateString($nocaptitle, 47); ?> <li class="feeditem"> <?=$row['new']?><a href="<?=$row['permalink']?>" target=_new><?= $nocaptitle ?><div class="tooltip left silver"><div class="tooltiptitle"><?= preg_replace("/[^[:alnum:][:punct:][:space:]]/","", $row['title'] )?></div><div style="max-width: 282px; overflow: hidden;"><?= preg_replace("/[^[:alnum:][:punct:][:space:]]/","", $row['desc'] )?></div></div></a> </li> <? } ?> </ul> </div> </div> Any ideas why it's not working?
  7. When I replace my existing chunk of code with that, I get this error: "Fatal error: Cannot redeclare truncatestring() (previously declared in /home/threedn/public_html/templates/feeds.php:29) in /home/threedn/public_html/templates/feeds.php on line 29" Line 29 ends up being the very first line of your code. I think I see that the error is trying to process your code again for the second (of many) instances I need to use it on a single page. Can a fix be supplied to correct this issue, or is the problem where I'm placing the code?
  8. First, let me state I'm fairly noob when it comes to php, and am merely surviving by finding examples on the Internet. I've spent many hours looking for how to do it, and the closest I've came was this code: $pos = strpos($nocaptitle, ' ', 47); if ($pos !== false) { $nocaptitle = substr($nocaptitle, 0, $pos); This code appears to work how I want it to, except if $nocaptitle is shorter than 47 characters, then I get an error. Can anybody help me finalize this code so it works even if there are fewer than 47 characters? Again, I've looked over the internet, and this is the code that best suited me, other php help sites that offered examples, had higher rated examples than this one, but those examples would think it was OK to cut something "T-mobile" after the T-, the code above is the best I've seen where it keeps words with dashes intact. So while there may be a better way of doing what the above code does, unless it doesn't have that t-mobile problem, I'd prefer you not completely re-write the code as an answer, and just help me fix the code I have. (If you have better code, but it doesn't have this "T-mobile" problem, please post. I'm noob, so if you could post the code that I will need to add or replace, this is what will help. Telling me about what php code to use, but not actually writing it out, will be over my head. Thanks for any help you can provide, on this probably super easy problem for most php coders here.
  9. I am not a programmer, but I'm a webmaster facing a problem. I have a website and people are hotlinking to my .swf files. I do not want to stop all hotlinking though, instead is what I want to do, and want to know if it's possible to do, is this: Can I get it so that people that hotlink to flash files, get an ad before the flash loads, without editing the "real" .swf? For example: 1. I post the actual .swf file to my site. 2. Then someone embeds a direct link to that .swf file on their site or blog, etc. 3. My server, when serving .swf files realizes when the .swf file isn't coming from my domain. 4. It makes the direct .swf embed be an embed to a wrapper (I think is what it would be called) type of flash file that has an ad and a start button. 5. The real .swf file is loaded on the external domain once the start button is clicked in the "wrapper". Few questions: 1. So again, my question is this, is something like this possible, so I can gain some money from those sites ALREADY hotlinking to the .swf files on my server? 2. If this isn't possible to get on already previous hotlinked .swf files, is something like the example mentioned above possible from a new start, so that when people link to an .swf file on my site, they think they're getting the file, but in reality they're getting the wrapper that displays the ad first, and then it calls the real .swf file? 3.I am not currently looking for a programmer to do this work, but I am interested in a rough estimate so I can make plans on how I should proceed for my current problem. Thanks for any input you can provide me with on this subject. Sorry if this is more about flash programming than php programming, I don't know how it would be programmed.
  10. I have flash content loading up on my site, and I'm wondering if it's possible to a section on that same page that has ajax on it. The content in the ajax section needs to reload with new content that was previously "grabbed", but the flash that is on the page needs to stay in focus. By focus, I mean that mouse and keyboard functions need to continue to work when the content is displayed using ajax? 1. Is this possible? 2. Can anybody create a quick demo for me, so I can see that it does in fact work the way I need it to? I can give more details in PM if needed. Thanks for any help you can provide!
  11. I am at a crossroads. I want to have our website both redesigned graphically as well as need the backend code recoded, retooled, updated, tweaked, etc. I am not a programmer, but I can make decent graphics myself. However, with that said, the graphical redesign I want to give my site, would still involve coding to move objects around, something of which I am not capable of. The decision I face is which to do first? Do I do a graphical redesign first, so that the graphics and layout are already there so that when I want my programmer to add features, they are adding them where they are going to stay. Or do I do a code redesign, tweak where I am adding new features to existing code, and have code that is old rewritten for better function, but put it in spots that may not look as good or as pleasing to the eye, until the graphical design comes? Which is better as far as user experience? Which is going to be cheaper and more cost effective? On the one hand, if I do a graphical redesign first, then things should be in place for where I want new features to end up, and the site looks good, even if it lacks features and may feature open spots where somethings aren't appearing, simply because they haven't been coded yet. Also, I can tell the programmer right where I want the feature they're coding to appear, and once it's inserted, it's where it's going to stay. On the other hand, if I have the coding done first, then as the features are coded, I can have them put in approximate places where I want them, and the features will be coded, but may need to be moved later on to make it more appealing, or be made more visible by being moved. BUT, if the features are already coded, I will know what types of pages I need to have designed, and what all I need to have pages for. Is it cheaper to have a programmer come back and move the code around, or to have a design moved around so that the feature is where I want it to be? I know more/better features will bring more visitors to my site, but so can that initial first time you visit a webpage and the graphical design really looks appealing. It hasn't escaped me that you may need to know what condition the actual site is in that I'm talking about. If so, it's www.gamesforwork.com It lacks both features and a very Web 2.0 design with all the css and ajax bells and whistles. Can any programmers or graphical designers out there give me some ideas, on which direction I should take? I already have my ideas for features, I don't need ideas like that. I am more looking for if it's going to cost a lot more for me to do the graphics first, or the programming first. Thanks for any insight you may have on this. (If it makes any difference our recode would be php,mysql,css,ajax/javascript with quite a bit of database driven pages that organize and display the content the user is interested in)
  12. Some pages in my script for flash games, are giving this error: Warning: getimagesize(./swf/Climb or Drown_april_7th_2010.swf) [function.getimagesize]: failed to open stream: No such file or directory in /home/games4w/public_html/games/system.class.php on line 431 I say some, as only some pages are giving the error, but others work fine. The error use to say line 430 and I had this on that line: list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($this->swfdir."/".$game['game_swf']); But someone told me to change from that to this: $swfPath = $this->swfdir . '/' . trim($game['game_swf']); list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($swfPath); That is when it changed to line 431. Line 431 is the "list($imagewidth," part of that. Does anybody else have any ideas for me on how to resolve this error? The strange thing is that when I made that change, the games were displaying the error, actually stopped showing the error, but then after browsing the site more, I found out other games still show the error. Can anybody please help me?
  13. Hi MadTechie, Are you saying I should replace my entire line 430 with the exact code you posted? One thing that has me a little concerned is that I am not getting the error myself, but users are reporting it, so I would have to publish the code, and then contact them to get them to test it. If you can tell me what code to replace specifically though, I am certainly willing to try. Should I post some more lines of code around line 430? Thanks for the code snippet MadTechie!
  14. 1. File is there, check the link I posted, despite users getting errors on pages, where game file is. 2. getimagesize does, and has always worked with the site. A site that ONLY uses .swf files. Other ideas?
  15. I have users complaining that my site is giving the following error. (though I have not experienced them) Warning: getimagesize(./swf/Matter Shift_march_10th_2010.swf ) [function.getimagesize]: failed to open stream: No such file or directory in/home/games4w/public_html/games/system.class.php on line 430 Warning: Division by zero in /home/games4w/public_html/games/system.class.php on line 519 Warning: Division by zero in /home/games4w/public_html/games/system.class.php on line 520 I am hoping to find a solution to the problem. The actual page that these errors are coming from are http://www.gamesforwork.com/games/play-14719-Matter_Shift-Flash_Game I am not very much of a programmer. These are the lines that are referred to in that error: 430 list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($this->swfdir."/".$game['game_swf']); 519 $imagewidth = $imagewidth / $div; 520 $imageheight = $imageheight / $div; Can anybody please help me find a solution to these errors? I am not a programmer, but I can insert code and ask my host to change server configurations if they need to be. Thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.