Jump to content

khr2003

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by khr2003

  1. I would recommend that you use php alternative to js which is quite the same and I do not see why you use js. Also, it is better to use iframe rather than fbml since the latter will be deprecated in couple of months.
  2. check phpthumb http://phpthumb.sourceforge.net/
  3. that is my intention exactly. I think viperjts10 does not have any problem including the php file, it is the html inside it (and more specifically the style sheet) that needs to be included properly, thus the base tag.
  4. it is not enough to add the page number of the url. what you need also is the row number from the page will read and the maximum number of data rows to be read. So this line (at the top of your code): $sql="SELECT * FROM $tbl_name WHERE forumid=$id ORDER BY lastreply DESC"; should look like this (note the LIMIT part): $sql="SELECT * FROM $tbl_name WHERE forumid=$id ORDER BY lastreply LIMIT $start_numbet, $max_number DESC"; so you either include these number in the url and retrieve them through $_GET, or you calculate them outside the function based on the page number and the $page_rows value. hope this helps
  5. There is a missing curly bracket at the end of your code, aside from that you code looks fine. Are you receiving any errors when you run the code?
  6. That will depend on the types of files that you have. PHP has native support for files with txt or html extensions. If your files are stored in this way you can use the files functions that php has to read files such as file(), file_get_contnets(), fread() then you can search the text using strstr(), stristr(), strpos(). You can also use regular expression to search the text if you want to add an extra layer of complexity to the results.
  7. array_multisort() will reindex numerical associative arrays. Are you trying to assort the first level array or the whole array including all levels down? check out the array sorting functions comparison on this link: http://www.php.net/manual/en/array.sorting.php and see the one the fits your script.
  8. hi try to change the database encoding to utf-8 as well as the browser. Alternatively, if the database is set to another encoding (perhaps to Greek) then try to set the browser to the same encoding as your database.
  9. for a start try to place the post block outside the while loop. why the names of the input is followed by <?php echo $row['pkey']?> ? if you want unique input values try the "id" attribute.
  10. khr2003

    Hello

    welcome to php freaks. I am sure you will find this website a useful resource.
  11. Do you gen any kind of errors? You can use this function simplexml_load_file as a good and simple way of loading xml file. The function is part of the simplexml library but you would need to create an object to use it.
  12. Hi Last week I was designing a theme form my CMS (or actually converting a theme) that resembles twitter design. Since the website layout consists of three columns I faced the issue of the div height. Even if the div height is set to 100%, the div container does not extend to match the longest of the three columns . I have faced this issue previously; however I used different solutions which were not very efficient. I am aware of the idea of Faux Columns and also the idea of setting the parent div height to 100%, but I think both of them do not provide a sufficient solution to the problem. let us cut to the solution. Suppose you have a website layout like this one: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <style> #main-container { width: 1000px; } #left-side-bar { float: left; font: normal 12px arial, sans-serif; width: 200px; background-color: #ddeef6; } #contents { float: left; font: normal 12px arial, sans-serif; width: 600px; background-color: #ddeec8; } #right-side-bar { float: right; font: normal 12px arial, sans-serif; width: 200px; background-color: #ddeef6; } </style> </head> <body> <div id="main-container"> <div id="left-side-bar">Side bar text <br></div> <div id="contents">Lorem ipsum dolor sit amet </div> <div id="right-side-bar">Side bar text</div> <div style="clear:both"> </div> </div> if the any of the tree columns (left-side-bar, contents, right-side-bar) become very long the other div containers will not extend 100% of the parent container. To overcome this I used position, z-index and couple of extra divs. Simply, I will add an extra div to each sidebar which will extends on the whole parent container (main-container) and then using the stack order propriety (z-index) I will place these new divs behind the original menu sidebars. so the former code will look like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <style> #main-container { width: 1000px; /* set this div position to relative so the sub container that has absolute position will extened within it and not the browser*/ position: relative; } #left-side-bar { float: left; font: normal 12px arial, sans-serif; width: 200px; background-color: #ddeef6; /* set position to relative in order for the z-index to be applied to this container */ position: relative; /* set z-index to a high number to keep the container on top of its duplicate */ z-index: 99; } #contents { float: left; font: normal 12px arial, sans-serif; width: 600px; background-color: #ddeec8; } #right-side-bar { float: right; font: normal 12px arial, sans-serif; width: 200px; background-color: #ddeef6; /* set position to relative in order for the z-index to be applied to this container */ position: relative; /* set z-index to a high number to keep the container on top of its duplicate */ z-index: 99; } #left-side-bar-bg { float: left; font: normal 12px arial, sans-serif; width: 200px; background-color: #ddeef6; /* add absolute position to this selector*/ position: absolute; /* add top and bottom margins of the absolute position*/ top: 0; bottom: 0; /* since this is the selector for left menus bar we add the left margin */ left: 0; /* set z-index to 0 to keep it the container lower than the original one */ z-index: 0; } #right-side-bar-bg { float: right; font: normal 12px arial, sans-serif; width: 200px; background-color: #ddeef6; /* add absolute position to this selector*/ position: absolute; /* add top and bottom margins of the absolute position*/ top: 0; bottom: 0; /* since this is the selector for right menus bar we add the right margin */ right: 0; /* set z-index to 0 to keep the container lower than the original one */ z-index: 0; } </style> </head> <body> <div id="main-container"> <--! the background div for the left side bar--> <div id="left-side-bar-bg"></div> <div id="left-side-bar">Side bar text <br></div> <div id="contents">Lorem ipsum dolor sit amet </div> <div id="right-side-bar">Side bar text</div> <--! the background div for the right side bar--> <div id="right-side-bar-bg"></div> <div style="clear:both"> </body> you can use colours or images as a background without any hassle. I have added an elaborate tutorial on my blog, if you would like more detail: http://diy-cms.com/mod.php?mod=blog&modfile=viewpost&blogid=20 Hope this helps.
  13. You can use phpmailer for all sorts of email process with advanced or minimal functionality. It contains a highly advanced SMTP functionality that is can seamlessly integrate into any kind of application it is free and in php
  14. change this line: $str = preg_replace($htmlcode, $bbcode, $str); to this: $str = preg_replace($bbcode, $htmlcode, $str); You need to take the bbcode and convert it into html and not otherwise.
  15. check if you have defined the object and if the function exists in the class that the object points to
  16. check out these php array sorting functions: http://www.php.net/manual/en/array.sorting.php I think you will need to use ksort() or krsort() depndes on what you need to accomplish
  17. or use phpmailer http://phpmailer.worxware.com/index.php?pg=examples
  18. Each one of them has different way of developing plug-ins. I believe that they are all the same. I do not think that any of them is "better" than the other. They all have their strength areas. It really depends on what and how you use them. May I also suggest that you look at this CMS: www.diy-cms.com.
  19. hi I do not think this is a smart design. Adding contents in different languages is not (mostly) practical. However, if you really determined to your concept you can do the following: Language Table ID Language 1 English 2 Arabic 3 French Content Table id lang_id content 1 2 Arabic content 2 2 Arabic Content 3 3 French content 4 5 content in another language 5 1 English content etc ... You can design a select menu that you can choose which language the contents belong to.
  20. I think website layout can sometimes be effective to deliver certain messages. From my experiences scam website tend to have similar appearance. Aside from the design, do not give fancy promises or advertisements and do not make them look like they are "too good to be true". Always make your offers reasonable. Give real details about your business or even you. For instance, you can include your business address which makes it easy for the buyer to check if it is a real location with real business on google maps. In many countries (at least where I come from) business have unique numbers to identify them in different government departments. You can include this as well. Bottom line think of yourself as the buyer who to check if the website is scam or not.
  21. There are numerous books and website teaching php language. Googlong "learn PHP" or Youtubing "learn PHP" will bring many resources on how to learn php from a beginner level. There are many learning methods, but I believe that the most important think is to set your objective first "what do you want to accomplish?" Also, Is your script going to be for personal, private or public use? Are you developing it for a business? What functionalities do you want to include? These sort of questions will give you clear start point and will make learning easier. Another suggestion, find a small or medium scale php script. Learn all its details (how it is structured, what kind of programming style does it use and how does it use php functions in general ... etc) Try to create plug ins or any small additions to that script, such practice will increase your understanding of the script and of php language in general. Useful Resources: http://www.w3schools.com/php/default.asp http://devzone.zend.com/article/627 http://www.learnphp.org/ http://www.google.com.au/search?q=learn+php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a http://www.youtube.com/results?search_query=learn%20php&search=Search&sa=X&oi=spell&resnum=0&spell=1 That is all I got at the moment.
  22. actually, you have to select "convert to UTF-8 without BOM" in notepad++ and save the file in order to display the characters correctly in your browser. "Encode in UTF-8 Without BOM" will only change the display in the file view. Additioanlly, you browser encoding has to bet set to utf-8 as well.
  23. This is a start http://www.w3schools.com/php/php_db_odbc.asp http://www.php.net/manual/en/book.uodbc.php
  24. ok I checked the code and here are my thoughts: 1- to check if the form is posted you have to check for a value that is really posted so the first line should look like: if($_POST['submit']) 2- Even if I use the previous line to check for form submission I will not get any results since the submit button does not have a name attribute in your form so you should change it to. <input type="submit" name="submit" value="Display the tree" > 3- You have to check the if/else statments in your code they seem to be messed up. 4- you can use extract function to get the values of $_POST. (See the code below) 5- some notes that would not affect the code currently but for future refrences (once you update to php 5.3.0 or 6.0.0): - do not use short tags like <?, instead use <?php at the beginning of of the file. - using the end tag is ?> is optional. - erge-related functions are being deprecated as of php 5.3.0 That is what I got so far and felt important that you know to improve your code even if it is a small-scale code. and here is the modfied code (i only check the posting format) so you can improve on it: <HTML> <HEAD> <TITLE>The Greeting Trees </TITLE> </HEAD> <BODY bgcolor=" #3BB9FF"> <?php /* Your brief description of this program which may include input, output, requirements, and your design highlights */ if ($_POST[submit]) { extract($_POST); if (($size == "") || (!$tree)) { echo ("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Oops, you forgot to supply some information. </b></font><br>"); } else if ((!ereg("[0-9]", $size))) { echo ("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Please restrict your input to only numbers.</b></font><br>"); } else if (($size < "12") || ($size > "24")) { echo ("<font face=\"Tahoma\" size=\"2\" color=\"#FF0000\"><b>Out of range</b></font><br>"); } else { $A = array( $size ); if (($size % 2 == 0)) $center = (($size / 2)) && (($size / 2 + 1)); else $center = int($size / 2); for ($i = 0; $i < 5; $i++) { for ($j = ($center - $i); $j <= ($center + $i); $j++) { $A[$i + 2][$j] = "*"; } } for ($i = 0; $i < $N; $i++) { for ($j = 0; $j < $N; $j++) { DisplayChar($type, $A[$i][$j]); } echo "<BR>"; } } } else { //Form to collect user input: one of the 3 greeting tree types ?> <FORM METHOD="post" ACTION="test.php"> <p>Please enter a tree size between 12 and 24:</p> <input type="text" name="size" /> <p>Select tree type:</p> <input type="radio" name="tree" value="Holiday" /> Holiday <input type="radio" name="tree" value="SacState" /> SacState <input type="radio" name="tree" value="Suprise" /> Suprise <br/> <input type="submit" name='submit' value="Display the tree" /> </FORM> <?php } ?> </BODY> </HTML>
×
×
  • 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.