Jump to content
php.lv forumi

Linee

Reģistrētie lietotāji
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Linee

  1.  

    Svarīgi kādā formā/veidā dati tiek ielikti datubāzē, ja tie jau vienreiz ir apstrādāti, tad otrreiz to darīt nevajag (rodas šādas "ķeskas").

     

     

    Pagaidām (tā uz labu laimi) var ieteikt, tur kur ir:

     

    <span style="font-weight: bold;"><?php echo htmlspecialchars($row['ttitle']);?> ...</span><br />

     

    vienkārši izņemt to htmlspecialchars():

     

    <span style="font-weight: bold;"><?php echo $row['ttitle'];?> ...</span><br />

     

    Liels tev paldies, viss izdevās..

     

    Veram ciet sadaļu

  2. 
    

    <html>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <?php

     

    $config->user_page = ''; ## Ievadi linku uz Profila atrašanās vietu

    $config->noavatar_link = 'http://localhost/forum/public/style_images/master/profile/default_large.png'; ## ievadi linku uz no avatar atrašanās vietu

    $config->forum_url = 'forum'; ## Ievadi linku uz foruma atrašanās vietu

    $config->limit = '10'; ## Cik postus izvadam ?$config->tlimit = '20'; ## //cik daudz simboli driikst buut topika nosaukumaa

    $config->topic_link = 'http://localhost/forum' ; ## Links uz topiku $size = 25; //cik daudz simboli driikst buut topika nosaukumaa

    $config->mysql = (object)array(

    'host' => 'localhost', ## Ievadi MYSQL datubāzes hostu

    'user' => 'usr', ## Ievadi MYSQL datubāzes useri

    'db' => 'usr', ## Ievadi MYSQL datubāzes db

    'pw' => 'pw', ## Ievadi MYSQL datubāzes paroli

    'prefix'=> ''

     

    );

     

     

    /** Beidzās skripta konfigurācija **/

     

    $conn = @mysql_connect($config->mysql->host, $config->mysql->user, $config->mysql->pw) or die('<p>Neizdevās pieslēgties datubāzes lietotājam `' . $config->mysql->user . '`!</p>');

    @mysql_select_db($config->mysql->db,$conn) or die('<p>Neizdevās pieslēgties datubāzei `' . $config->mysql->db . '`!</p>')

     

     

    ;

     

     

     

    $query = mysql_query("

    SELECT

    LEFT(t.title,28) as ttitle,

    t.tid as tid,

    t.state as tstate,

    t.posts as tposts ,

    t.start_date as tstart_date,

    t.last_poster_id as tlast_poster_id,

    t.starter_name as tstarter_name,

    t.last_poster_name as tlast_poster_name,

    t.seo_first_name as tseo_first_name,

    t.pinned as tpinned,

    t.poll_state as tpoll_state,

    t.title_seo as ttitle_seo,

    t.seo_last_name as tseo_last_name,

    t.views as tviews,

     

    m.member_group_id as mmember_group_id,

    m.posts as posts,

     

    g.prefix AS group_ref,

    g.suffix AS group_suf,

    g.g_title AS gtitle,

     

    a.pp_main_photo as pp_thumb_photo

     

    FROM ".$config->mysql->prefix."topics t

    LEFT JOIN ".$config->mysql->prefix." members m ON m.member_id = t.last_poster_id

    LEFT JOIN ".$config->mysql->prefix."groups g ON g.g_id = m.member_group_id

    LEFT JOIN ".$config->mysql->prefix."profile_portal a ON a.pp_member_id = m.member_id

    GROUP BY t.tid

    ORDER BY t.last_post DESC

     

    LIMIT ".$config->limit."

    ") or die(mysql_error());

    while($row = mysql_fetch_array($query)){

     

    if(empty($row['pp_thumb_photo'])){

    $avatar = $config->noavatar_link;

    }else{

    $avatar = $config->forum_url.'/uploads/'.$row['pp_thumb_photo'];

    }

    // *** ŠEIT VARI SĀKT SAVUS DIZAINBA PIELĀGOJUMS ;) ** //

    ?>

    <!-- Izvadam pēdējā atbildētāja avataru -->

    <div class="Forum">

     

    <div class="Forumimg">

     

    <img style="border-radius: 25%;margin-right:5px;float:left;width:30px;height:30px;padding:1px;border:1px solid #e5e5e5;" src="<?php echo $avatar;?>"width="30px;" height="30px;"></a>

    </div>

    <div class="ForumT">

     

     

    <a style=" text-decoration: none;" href="/forum/index.php?/topic/<?php echo htmlspecialchars($row['tid']);?>-<?php echo htmlspecialchars($row['ttitle']);?>" class="tooltip" >

    <span style="font-weight: bold;"><?php echo htmlspecialchars($row['ttitle']);?> ...</span><br />

    <span style="font-size: 10px;">Komentāri: <?php echo htmlspecialchars($row['tposts']);?></span>

    </a>

    </div>

    </div>

    <?php

    // **** ŠEIT BEIDSAS TAVI PIELAGOJUMI ****//

    }

    ?>

    </html>

  3. Sveiki. Esmu absolūta 0 kodēšanā, ceru uz jūsu palīdzību,

     

    Man vienam skriptam vajadzētu uzlikt substr funkciju, kas izvada no foruma topika nosaukumu... respektīvi vajag, lai viņš izvada tikai pirmos 25 simbolus no topika nosaukuma...

    Koderim vajadzētu būt tīrākais sviestmaizei to izdarīt.. es tāds nēesmu :D

    <html>
    
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    
    <?php
    
    
    
    $config->user_page = ''; ## Ievadi linku uz Profila atrašanās vietu
    
    $config->noavatar_link = 'http://.../forum/public/style_images/.../profile/default_large.png'; ## ievadi linku uz no avatar atrašanās vietu
    
    $config->forum_url = 'forum'; ## Ievadi linku uz foruma atrašanās vietu
    $config->limit = '5'; ## Cik postus izvadam ?
    $config->topic_link = 'http://.../forum' ; ## Links uz topiku 
    
    
    $config->mysql = (object)array(
    
    'host' => 'localhost', ## Ievadi MYSQL datubāzes hostu
    
    'user' => 'user', ## Ievadi MYSQL datubāzes useri
    
    'db' => 'user', ## Ievadi MYSQL datubāzes db
    
    'pw' => 'pass', ## Ievadi MYSQL datubāzes paroli
    
    'prefix'=> '' 
    
    
    
    );
    
    
    
    
    
    /** Beidzās skripta konfigurācija **/
    
    
    
    $conn = @mysql_connect($config->mysql->host, $config->mysql->user, $config->mysql->pw) or die('<p>Neizdevās pieslēgties datubāzes lietotājam `' . $config->mysql->user . '`!</p>');
    
    @mysql_select_db($config->mysql->db,$conn) or die('<p>Neizdevās pieslēgties datubāzei `' . $config->mysql->db . '`!</p>')
    
    
    
    
    
    ;
    
    
    
    
    
    
    
    $query = mysql_query("
    
    SELECT
    
    t.title as ttitle,
    
    t.tid as tid,
    
    t.state as tstate,
    
    t.posts as tposts ,
    
    t.start_date as tstart_date,
    
    t.last_poster_id as tlast_poster_id,
    
    t.starter_name  as tstarter_name,
    
    t.last_poster_name as tlast_poster_name,
    
    t.seo_first_name as tseo_first_name,
    
    t.pinned  as tpinned,
    
    t.poll_state as tpoll_state,
    
    t.title_seo as ttitle_seo,
    
    t.seo_last_name as tseo_last_name,
    
    t.views as tviews,
    
    
    
    m.member_group_id as mmember_group_id,
    
    m.posts as posts,
    
    
    
    g.prefix AS group_ref,
    
    g.suffix AS group_suf,
    
    g.g_title AS gtitle,
    
    
    
    a.pp_main_photo as pp_thumb_photo
    
    
    
    FROM  ".$config->mysql->prefix."topics t 
    
    LEFT JOIN  ".$config->mysql->prefix." members m ON m.member_id = t.last_poster_id
    
    LEFT JOIN  ".$config->mysql->prefix."groups g ON g.g_id = m.member_group_id
    
    LEFT JOIN  ".$config->mysql->prefix."profile_portal a ON a.pp_member_id = m.member_id
    
    GROUP BY t.tid
    
    
    ORDER BY t.last_post DESC 
    
    
    
    LIMIT ".$config->limit."
    
    ") or die(mysql_error());
    
    
    
    while($row = mysql_fetch_array($query)){
    
    
    
    if(empty($row['pp_thumb_photo'])){
    
    $avatar = $config->noavatar_link;
    
    }else{
    
    $avatar = $config->forum_url.'/uploads/'.$row['pp_thumb_photo'];
    
    }
    
    
    
    
    ?>
    
    <!-- Izvadam pēdējā atbildētāja avataru -->
    
    <div class="Forum">
    
    <div class="Forumimg">
    
    
    
    <img alt="" src="<?php echo $avatar;?>" width="25px;" height="25px;"></a>
    
    </div>
    
    <div class="ForumT">
    
    
    
    
    
    <a style=" text-decoration: none;" href="/forum/index.php?/topic/<?php echo htmlspecialchars($row['tid']);?>-<?php echo htmlspecialchars($row['ttitle']);?>" class="tooltip"  >
    
    <span style="font-weight: bold;"><?php echo htmlspecialchars($row['ttitle']);?></span><br />
    
    <span style="font-size: 10px;">Komentāri: <?php echo htmlspecialchars($row['tposts']);?></span>
    
    </a>
    
    </div>
    
    </div>
    
    <?php
    
    
    
    }
    
    ?> 
    
    </html>
    
×
×
  • Create New...