 |
Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc Comunitatea PHP Romania
|
| Subiectul anterior :: Subiectul următor |
| Autor |
Mesaj |
SLK
Data înscrierii: 10/Mai/2008
Mesaje: 2
|
| Trimis: Sâm Mai 10, 2008 10:32 am Titlul subiectului: O mica intrebare |
|
|
Proiectul meu este urmator :
Un fel de ghid online combinat cu o communitate de gameri .
Site-ul este inca in stagiul de construire insa m-am blocat la o chestie chiar banala . Am un script de "query" pentru ultimiile posturi din phpbb si vreau sa arate data in romana.
Cam asa arata scriptul :
Cod:
<?
$scroll = "up";
// calea catre forum
$urlPath = "";
$dbms = 'mysql';
$dbhost = 'localhost';
$dbname = 'forum';
$dbuser = 'root';
$dbpasswd = '*****';
$table_prefix = 'phpbb_';
define('PHPBB_INSTALLED', true);
// Connecting & Selecting Databases
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id
AND f.forum_id = t.forum_id
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT 5";
$result = mysql_query($query) or die("Query failed");
print "<table><tr><td colspan=3>Last 5 Topics</td></tr>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<tr><td>
<a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]&forum=$row[forum_id]\" target=\"_blank\">" . $row["topic_title"] . "</a></td>
<td>Last post by: <a href=\"$urlPath/profile.php?mode=viewprofile&u=$row[user_id]\" target=\"_blank\">" . $row["username"] . "</a></td>
<td>" . date('j F, Y, g:i a', $row["post_time"]) . "</td></tr>";
}
print "</table>";
?>
Tot ce vreau sa arate zilele in romana , de exemplu in loc de "Monday" sa scrie "Luni" , si in ziua in care suntem sa arate "Astazi" eventual ziua care a trecut sa arate "Ieri" .
Sper ca am postat unde trebuie , tot ce cer un mic ajutor sa stiu de unde sa pornesc .
Multumesc anticipat ,
Soby |
|
| Sus |
|
crivion
Data înscrierii: 10/Apr/2007
Mesaje: 677
Locație: Somewhere
|
| Trimis: Sâm Mai 10, 2008 10:49 am Titlul subiectului: |
|
|
1. http://php.net/str_replace
2. definesti un array cu corespondentul in romana a cuvintelor din engleza |
|
| Sus |
|
SLK
Data înscrierii: 10/Mai/2008
Mesaje: 2
|
| Trimis: Sâm Mai 10, 2008 10:55 am Titlul subiectului: |
|
|
Un exemplu pentru situatia de mai sus poti sa-mi dai te rog frumos ?
De exemplu pentru luni . :) |
|
| Sus |
|
saitek
Data înscrierii: 23/Sep/2007
Mesaje: 450
|
| Trimis: Sâm Mai 10, 2008 11:13 am Titlul subiectului: |
|
|
mai bine faci asa:
Cod:
function bla($value){
$luni = array('Monday'=>'Luni',
'Tuesday'=>'Marti');
return $luni[$value];
}
|
|
| Sus |
|
PHPRomania Bot
Bot Member
Data înscrierii: 27/Dec/2007
Mesaje: 1
Locaţie: Server Google |
| Trimis: Mie Dec 26, 2007 7:01 pm Titlul subiectului: Ad |
|
|
|
|
|
| Sus |
|
| |
|