Board index   FAQ   Search  
Register  Login
Board index php forum :: Bar Free time

Numbering

Bar discussions . Talk about everything not only php !. Guests are welcome here , forum registration is not required.

Moderators: macek, egami, gesf

Postby admin » Thu May 05, 2005 11:33 pm

Code: Select all
<?php
$path = "whatever the path to the file is";
$fp = fopen($path, 'r');
do //we loop until there is no data left
{
       $data = fread($fp, 8192);
       if (strlen($data) == 0) break;
       $content .= $data;
     } while (true);
$content_encode = chunk_split(base64_encode($content));
$message .= $content_encode . "\n";
$message .= "--" . $boundary . "\n";


$headers  = "From: \"Me\"<me@here.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
mail('myAddress@hotmail.com', 'Email with attachment from PHP', $message, $headers);
?>


Alexei , fantastic work! :)
User avatar
admin
Site Admin
Site Admin
 
Posts: 123
Joined: Wed Apr 17, 2002 7:49 am
Location: Rome, Italy

Postby Virtuoso » Fri May 06, 2005 4:44 am

You could make it so that it takes of all the line breaks before and after the code.
User avatar
Virtuoso
php-forum Active User
php-forum Active User
 
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am

Postby Alexej Kubarev » Fri May 06, 2005 6:19 am

well... i think its quite useless... and plus: user can decide himself..
if he will put a line break after a start of the code tag: there will be a linebreak..[/code]
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby WiZARD » Thu May 12, 2005 6:11 am

Alexei Kubarev wrote:well... i think its quite useless... and plus: user can decide himself..
if he will put a line break after a start of the code tag: there will be a linebreak..[/code]

as you see this post
http://www.php-forum.com/p/viewtopic.php?p=24577#24577
you can see what color highlighting is missed...
Reason:
1 too big
2 different remarks.
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby Alexej Kubarev » Thu May 12, 2005 6:22 am

NO no and no: you need to use <?php ?> or <? ?> tags for highliting to work ^^
it WILL work if you put them ^^
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby Alexej Kubarev » Thu May 12, 2005 6:26 am

here you go with some example:

Code: Select all
<?php
# Hi Wiz!

function func($param){
   //test function
   $var = $param . "adding text";
   return $var;
}

/*This one is highlighted*/
?>



Code: Select all
# Hi again Wiz!

function func2($param2){
   //test function
   $var2 = $param2 . "adding text again";
   return $var2;
}

/*
This one is NOT highlighted
*/
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby WiZARD » Thu May 12, 2005 6:36 am

гы!
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby Alexej Kubarev » Thu May 12, 2005 7:09 am

^^
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby WiZARD » Thu May 12, 2005 7:18 am

Alexei Kubarev wrote:^^

what exactly this ^^ mean?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby Alexej Kubarev » Thu May 12, 2005 7:22 am

(^_^) or ('._.) pick one :D just a smiley
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby gesf » Thu May 12, 2005 11:31 am

Hey Alex, try this lil' code in the hilite script:
Code: Select all
<?php

if (substr($code, 0, 2) != '<?' && strpos($code, '<?') == false) {
   $code_plus_block = "<?php\n$code\n?" . ">";
        // Or...  with the html entities
}

?>
So it will automatically add the php blocks to the code if they doesn't exists.
Not sure if it will work.
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby Alexej Kubarev » Thu May 12, 2005 11:57 am

its a bad idea..as sometimes people add html or simply SQL and therefore we dont want to add those tags..however thanx for the idea... or did you have other things iny our mind that im not aware of?
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby gesf » Thu May 12, 2005 11:15 pm

That's true :o
Ok, but there's always the possibility to add the blocks, hilite it and delete the blocks.
It will be hilited and without the blocks ;)
Well, just an idea! Also it's not that important!
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby swirlee » Fri May 13, 2005 9:35 am

gesf wrote:Ok, but there's always the possibility to add the blocks, hilite it and delete the blocks.
It will be hilited and without the blocks ;)


No, that would confuse the highlighter a lot. I agree that this isn't really necessary -- if people want their code highlighted correctly, they'll use the PHP tags. If not, tough luck.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby Alexej Kubarev » Fri May 13, 2005 9:40 am

Totally agree with Swirlee.
by the way: always wanted to ask: what does "swirlee" mean?
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Previous

Return to Free time

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron