Jump to content

Onloac

Members
  • Posts

    75
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Onloac's Achievements

Member

Member (2/5)

0

Reputation

  1. quick question... I have a column in my table called views. I want to reset the column to 0 for each row in the table. What's the easiest way to do this?
  2. Right now I have a link list a-z and 0-9. you click one of those links and your taken to page listing all items that start with that character. currently I'm using: SELECT * FROM my_table where LEFT(`my_item`,1)='$show' ORDER BY my_title ASC all I do right now is just add a link like ?show=a and everything that starts with a is listed. Now here is my problem. I want to listen all items that start with a numeric value listed all on one page instead of being spread across 0-9. If another solution becomes available I'd be more then happy to hear you out. But does anyone know how I can change my query to only list items that start with numbers?
  3. couldn't you just use an arabic font? EDIT: Did a quick search on google and found something that might help you. http://stackoverflow.com/questions/1284896/export-arabic-text-as-images
  4. Hello. I'm trying to create a function that will turn my timestamp into something like "9 hours ago", "3 days ago", ect.. so far I have the below function which seems to do the job fine. only problem is when i try to include it within a span it always places itself right before it. I use echo "<span class=\"smalltext\">".time_stamp($date)."</span>"; witht the following function function time_stamp($session_time) { $time_difference = time() - $session_time ; $seconds = $time_difference ; $minutes = round($time_difference / 60 ); $hours = round($time_difference / 3600 ); $days = round($time_difference / 86400 ); $weeks = round($time_difference / 604800 ); $months = round($time_difference / 2419200 ); $years = round($time_difference / 29030400 ); // Seconds if($seconds <= 60) { echo "$seconds seconds ago"; } //Minutes else if($minutes <=60) { if($minutes==1) { echo "one minute ago"; } else { echo "$minutes minutes ago"; } } //Hours else if($hours <=24) { if($hours==1) { echo "one hour ago"; } else { echo "$hours hours ago"; } } //Days else if($days <= 7) { if($days==1) { echo "one day ago"; } else { echo "$days days ago"; } } //Weeks else if($weeks <= 4) { if($weeks==1) { echo "one week ago"; } else { echo "$weeks weeks ago"; } } //Months else if($months <=12) { if($months==1) { echo "one month ago"; } else { echo "$months months ago"; } } //Years else { if($years==1) { echo "one year ago"; } else { echo "$years years ago"; } } } in the end I get the span tag with nothing in it and the text right before it. What am I doing wrong?
  5. yeah. You better research a little more before you jump into things like this. You'll want all your content, settings, user info in the database. Start simple... make something that adds text through a text box. Once you have it successfully do that, go onto making a page to pull the content from the database and display it. Just keep in mind, if your site gets big people will start to test your skills as a programmer. I'm still in the process of learning myself but I've learned its always good to cover your back. Make sure you keep in mind that just because you don't want someone to do something doesn't me they wont. Just read up on a couple tutorials use their code to base your script off of... then once you learn more you can eventually replace it with something of your own.
  6. Actually, i thought I spotted a problem but was wrong so I removed the post. =p
  7. What changed on your server? What does that code produce? Do you get any errors?
  8. If you want to place text dynamically over a image you could use the below code I found through google. <?php //PHP's GD class functions can create a variety of output image //types, this example creates a jpeg header("Content-Type: image/jpeg"); //open up the image you want to put text over $im = ImageCreateFromGif("template.gif"); //The numbers are the RGB values of the color you want to use $black = ImageColorAllocate($im, 255, 255, 255); //The canvas's (0,0) position is the upper left corner //So this is how far down and to the right the text should start $start_x = 10; $start_y = 20; //This writes your text on the image in 12 point using verdana.ttf //For the type of effects you quoted, you'll want to use a truetype font //And not one of GD's built in fonts. Just upload the ttf file from your //c: windows fonts directory to your web server to use it. Imagettftext($im, 12, 0, $start_x, $start_y, $black, 'verdana.ttf', "text to write"); //Creates the jpeg image and sends it to the browser //100 is the jpeg quality percentage Imagejpeg($im, '', 100); ImageDestroy($im); ?> All you gotta do is provide the image, upload your font of choice, and change the text variable.
  9. Alright I just did some searching on google and found what your looking for. This does something similar to what you want. I'm sure you could edit it to your liking. Step 1 of 2 <?php function drupalicious_summarise($paragraph, $limit) { $textfield = strtok($paragraph, " "); while($textfield) { $text .= " $textfield"; $words++; if(($words >= $limit) && ((substr($textfield, -1) == "!")||(substr($textfield, -1) == "."))) break; $textfield = strtok(" "); } return ltrim($text); } ?> Step 2 of 2 <?php print drupalicious_summarise($textfieldname,20);?> $textfieldname = the name of the field you want trimmed. 20 = the number of words, to the nearest sentance, your text will be trimmed to.
  10. Well I'm sure there is a better way of doing it but could you just count white spaces and have everything after the 4th white space removed?
  11. Thanks! You guys have been very helpful as usual. I'll study the code and read up on filemtime. Thanks again! mjdamato@ did u have that code made already or did you just right it up? You hit the nail on the head... that code couldn't have been better. =p Thanks alot! I'm gonna alot from it.
  12. Sorry, I should have been more specific. I was looking to show the 5 last folders sorted by "the last time something inside the folder was changed". For example, I have images within a directory. I want to list the last 5 folders to have images added to it.
  13. Linux. I just need something simple that will show the names of the last 5 modified folders within a given directory. I've been looking around for something for ages. =(
  14. hi, I've tried searching google without luck so I thought I would try here. I'm trying to display the names of the last 5 modified folders within a directory i provide. Does anyone know a tutorial or site that could teach me how to do this?
  15. Yeah, I always liked the idea of having someone purposely attack my site to see where my weak points are. I'm no where near advance programmer so I know I have lots of flaws people could use against me. Only problem is finding someone you can trust... someone who won't take advantage of the situation.
×
×
  • 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.