Jump to content

rem

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by rem

  1. [quote author=obsidian link=topic=112039.msg454558#msg454558 date=1161282331] try this: [code] <?php $pattern = '|\[language:([a-z]{2})\](.+?)\[/language:$1\]|i'; preg_match_all($pattern, $String, $matches, PREG_SET_ORDER); for ($i = 0; $i < count($matches); $i++) {   echo "<p>Language: " . $matches[$i][1] . "<br />\n";   echo "Text:<br />" . $matches[$i][2] . "</p>\n"; } ?> [/code] preg_match_all() really is going to be the only way to pull all the submatches you're after. then, you can use the results to parse as you see fit. [/quote] Thank you, that's a wonderful idea... even though, I guess something's wrong with the pattern, cause I don't have any results. If I replace your pattern with mine, the language gets extracted but not the text, and also, each is displayed twice... So kinda messed up. I know my pattern is not quite great, cause my regex skills are pretty sucky :)
  2. I have mysql entries as posts. I want to make possible having within the same posts, multiple languages separated by [language:po][/language:po] tags. When  (for example) es or fr or en language link is clicked, only that specific text, from between the specific language tags to be displayed. ex: index.php?pg=my_page.php&lang=en - > when lang=en, need to extract only the [language:en] this is my english text [/language:en] tags from the "my_page.php" post. Any ideas? Thank you
  3. Hi, I'm trying to develop a plugin for my personal CMS. I need this to recognize any tags like [language:en] text here [/language:en] so I can have several languages (separated by this) within the same post. I managed to make it recognize the tags using regex but can't output within a variable or an array the actual language(s) (en, es, fr, or whatever) ... This is my code: [code] <?php $text = ' [language:en] Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam [/language:en]'; $rx = '/\[language:([a-z]{2})\]|\[\/language:([a-z]{2})\]/'; $text2 = preg_replace($rx, '', $text); echo $text2; ?> [/code] Any suggestions are very appreciated. Thanks a lot!
  4. [quote author=steveclondon link=topic=106968.msg437305#msg437305 date=1158681882] How have you got on with this. I to am wondering if I should use the mail() function or class to email my members when an advert is placed. This could be from a few hundred to several thousand. Would like to know how you got on and what you decided to do and which class you have used. [/quote] I finally decided to go with PHPMailer ( http://phpmailer.sourceforge.net/ ). It's very easy to work with and it had no issues using my SMTP server with. I heard this should be better than mail() function, don't know exactly why becasue I don't understand how a SMTP server is working, but decided to go with people smarter than I am :) Good luck!
  5. [quote author=ober link=topic=106968.msg428577#msg428577 date=1157476988] Well, do you have an IP address of the SMTP server?  I'd definatley go that route if you have the information. [/quote] yes, i do have an IP address of the SMTP server, as well as host name, username and password. so, seems this would be the best choice, isn't it? i was only concerned about the slow response I get from the server when emails are sent... and I did tested it with just a few, what about when it'll be in production and more emails will be involved? Thanks a lot, really appreciate it...
  6. [quote author=ober link=topic=106968.msg428554#msg428554 date=1157474195] .... SMTP is the protocol.  mail() is a PHP function.  PHPMailer is a class. Maybe you should understand what you're doing before you ask questions. [/quote] Ok, here's the thing: on phpmailer class, there's an option to either use the PHP mail() function, a SMTP server by providing an user and password if the server needs authentication or sendmail. I understand very well what am I doing, just need a professional's opinion on this matter on what's the better aproach: Should I email subscribers by using the PHP mail() function or by using the SMTP server option of phpmailer since sendmail is not a viable option? Thanks.
  7. Hi, I'm currently developing a PHP application and I was wondering about which method to send bulk emails to subscribers is better: SMTP or mail()? I'm using phpmailer class and need this to work smoothly for large lists. Any advice? Thank you very much! Regards, Remus.
  8. thanks a lot guys!!! your resources and directions had been very helpful!! i managed to fire up my own gallery :) from now on... all i gotta do is tweak it here and there and imporve it! best wishes! :) P.S. please consider MoneyBookers for donations too. Where I come from, PayPal doesn't work...
  9. [quote author=ryanlwh link=topic=102578.msg407586#msg407586 date=1154468379] glad that you got it :) may i suggest getting the filenames into an array with scandir, and then loop through the appropriate index of that array? [/quote] i think I'll have to use other function than scandire since my host is still using php4 (just realised it's a php5 function) ... so, I'll have to store them into an array anyhow :) and how should i "loop through the appropiate index of that array", anyway? :) ???
  10. i got it, i got it!!!! :) [code] <?php $max_results = 3; $from = (($page * $max_results) - $max_results);  $to = $from + $max_results; $x = -1; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $from < $x && $x <= $to) { echo "<div class='tile'><img src='images/" . $file . "' border='0' width='80' height='80' />\n"; $title = str_replace('.jpg','',$file); $title = strtoupper(str_replace('_',' ',$title)); echo "<span>" .  $x . "-" . $title . "</span>\n</div>\n\n"; } $x++; } ?> [/code]
  11. unfortunately i'm kinda forced to come back here guys... the tutorial HeyRay2 pointed me to was great, helped me to understand the pagination process but still, even I managed to get this done with, I'm stuck to the fetching images from x to y stuff from within the folder. here's my code, could you give me a hint, pretty please? thanks a mil! [code] <?php $dir = 'home/rem/www/images'; $files = @scandir($dir); $num_of_files = count($files) - 2; if(!isset($_GET['page'])) {     $page = 1; } else {     $page = $_GET['page']; } $max_results = 8; $from = (($page * $max_results) - $max_results);  if ($handle = opendir($dir)) { echo "<div id='gallery'>\n\n"; while (false !== ($file = readdir($handle))) // this is where i got stuck and can't figure it out... :( { if ($file != "." && $file != "..") { echo "<div class='tile'><img src='images/" . $file . "' border='0' width='80' height='80' />\n"; $title = str_replace('.jpg','',$file); $title = strtoupper(str_replace('_',' ',$title)); echo "<span>" . $title . "</span>\n</div>\n\n"; } } echo "<br clear='all' />\n\n</div>"; } $total_pages = ceil($num_of_files/$max_results); echo "<div style='padding: 5px; margin: 5px;'>"; if($page > 1) {     $prev = ($page - 1);     echo "<a href='" . $_SERVER['PHP_SELF'] . "?page=" . $prev . "'>&laquo;Prev</a> "; } for($i = 1; $i <= $total_pages; $i++) {     if(($page) == $i)     {         echo $i . "&nbsp;" ;     }     else     {         echo "<a href='" . $_SERVER['PHP_SELF'] . "?page=" . $i . "'>" . $i . "</a> ";     } } if($page < $total_pages) {     $next = ($page + 1);     echo "<a href='" . $_SERVER['PHP_SELF'] . "?page=" . $next . "'>Next&raquo;</a>"; } echo "</div>"; ?> [/code]
  12. thanks a lot, any resource is welcomed. next time, if i'll be able to output my gallery, i will not bother you guys anymore, instead maybe i'll be able to help other php newbies like i am now :)
  13. thanks a lot guys... really apreciate it :) i'll give that a try! is so cool to have some stuff to get me started...
  14. thanks for the reply... the images are by names. the name is uppercased and the .ext is dropped. i already looked over the pagination tutorials here but don't have a clue how to work with files within a folder :D thanks again anyway, I'll try dig some other resources as well...
  15. Dear all, I'm trying to develop a small photo gallery in PHP, without using MySQL. The images are taken from within a folder then displayed on the front end. This is something I already managed to achieve and I'm very pleased by the results but the downside is when have large amounts of pictures within the base folder... My page is loaded with tones of thumbs and have to scroll miles to get through it. Could you point me through an easy method of somehow paginating the results and organize them a bit? Thanks a lot! Regards, Rem.
  16. [!--quoteo(post=384042:date=Jun 14 2006, 07:34 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 14 2006, 07:34 PM) [snapback]384042[/snapback][/div][div class=\'quotemain\'][!--quotec--] Use a combination of substr and strpos: [a href=\"http://www.php.net/substr\" target=\"_blank\"]http://www.php.net/substr[/a] [a href=\"http://www.php.net/strpos\" target=\"_blank\"]http://www.php.net/strpos[/a] [/quote] Thanks a lot for the tip :) I'll surelly look into that!
  17. Hi everybody, How can I erase all chars in a string after a given point (like / , <>, or . ) ? ex: This is an example ... I need everything erased after the three points Thanks a lot, any help would be very appreciated! Regards, Rem.
×
×
  • 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.