Simple Smiles Not so simple

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

What gets output if you echo $read before running addbbcode() on it?
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

the same ?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Are you passing it :) or Smile?
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

:) is what im passing

Code: Select all

:)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Then what is this all about?

Code: Select all

<?php
function addbbcode($vartoproc) {
  return str_replace("Smile", '<img src="./image/smile.gif">', $vartoproc);
}
?>
this function is looking for the string 'Smile' and it is trying to turn that into the image path.
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

Yeah i changed that.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

First of all, you can replace

Code: Select all

$temp= $page2.'.txt';
$page2 = $temp;
with

Code: Select all

$page2 = $page2.'.txt';
Secondly, add

Code: Select all

echo $read;
after

Code: Select all

$read = fread($fp, '1000');
and post here your output!
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

oh, i think i got it :P if you look close Enought you Shuold see it ;)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I doubt any of us want to guess at what 'it' is. Regardless, you should post the solution so someone else may be helped by it in the future.
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

It was Simple Really, i had only put the BBcode in for the loading on a non-default page :roll:
Post Reply