Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)

[es] :: PHP :: php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)

[ Pregleda: 3056 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

kewy

Član broj: 105
Poruke: 141
*.ptt.yu.



Profil

icon php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)20.01.2007. u 15:25 - pre 210 meseci
nisam siguran da li je INCLUDE uopshte funkcija koja meni treba, ali evo shta me muchi...

hteo bih da na stranu ubacim sadrzaj jedne php skripte, ali ne kao
Code:
<?php include("news.php"); ?>

vec mi treba da otvara na primer:
news.php?vesti-sport=2


to sa INCLUDE koliko sam provalio ne mogu da uradim...

koje je najbolje resenje?


Hvala.
 
Odgovor na temu

ColdKeyboard
Sasa Karanovic
Hardware and Firmware Engineer
Toronto, Canada

Član broj: 31924
Poruke: 868
*.com
Via: [es] mailing liste

Jabber: ColdKeyboard
Sajt: www.SasaKaranovic.com


+11 Profil

icon Re: php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)20.01.2007. u 15:34 - pre 210 meseci
Jel mozesh da nam posaljesh kod od te skripte koja treba da cita te vesti ?
Include bi trebao da radi ako bi ta skripta radila echo onda bi radila i na
svakoj
stranici na kojoj napravish include, a ako bi podatke stavljala u neki array
ili
varijablu onda bi na toj stranici na kojoj si radio include treba da stavish
echo/print $ta_varijabla;

U svakom slucaju posalji nam kod pa da znamo o cemu se radi...

--
-==ColdKeyboard==-
www.SasaKaranovic.com
www.MrdniSe.com

------=_Part_141509_5539604.1169307283667
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<span class="sg">esauth:239513:2e906c04baa902428a79bb691674eff5<br>
 
Odgovor na temu

kewy

Član broj: 105
Poruke: 141
*.ptt.yu.



Profil

icon Re: php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)20.01.2007. u 16:27 - pre 210 meseci
u pitanju je malo kompleksniji PHP script koji se zove Xpression News : http://xpression.hogsmeade-village.com/download.php

jel kapirash shta mene muchi?

kad include-ujem fajl news.php sve radi kako treba, ali ja ne zelim da include-ujem sve vesti na stranicu, vec samo vesti iz kategorije "sport" recimo, i onda mi treba da pozovem : news.php?xnews-catlist=2

a to mi sa INCLUDE ne radi...


ovo je kod strane koja prikazuje vesti news.php
nadam se da shaljem pravu stvar... ja nazalost ne poznajem PHP...

Code:

$action=$_GET['xnewsaction'];
$deftemplate=GetDefaultTemplate();
$xout='';
if (!empty($_COOKIE['xnews-apskin'])){$template=$_COOKIE['xnews-apskin'];}
if (isset($_GET['xnews-template'])){$template=$_GET['xnews-template'];setcookie('xnews-apskin',$template);}
if (empty($template)){$template=$deftemplate;}
$xwrapper=file_get_contents($script['paths']['file']."templates/$template/content-wrapper.html");
if (empty($action))
{

  if (!isset($authorlist)){$authorlist=$_GET['xnews-authorlist'];}
  if (!isset($catlist)){$catlist=$_GET['xnews-catlist'];}
  $newsfiles=GetArchList($script['news']['sort']);
  $num=0;
  $newstpl=file_get_contents($script['paths']['file']."templates/$template/news-article.html");
  $news_wrapper=file_get_contents($script['paths']['file']."templates/$template/news-wrapper.html");
  if (count($newsfiles)>0)
  {
  foreach ($newsfiles as $i=>$line)
  {
     $news=GetNews($line,$catlist,$authorlist,$script['news']['show_first'],$script['news']['sort'],"");
     if (count($news)>0)
     {
     foreach ($news as $j=>$article)
      {
        $xout.=SkinNewsArticle($article,$newstpl);
        $num++;
        if ($num==$script['news']['show_first'])
        {
         break;
        }
      }
     }
      if ($num==$script['news']['show_first'])
      {
        break;
      }
  }
  }
  $news_wrapper=str_replace("{NEWS}",$xout,$news_wrapper);
  $xout=$news_wrapper;

} else if ($action=='getcomments')
 {
   $range=$_GET['range'];
   if ($range==''){$range='1-25';}
   $newsid=$_GET['newsid'];
   $newsarch=$_GET['newsarch'];
   $comments=GetComments($newsarch,$newsid,$range);
   $article=FullNews($newsarch,$newsid,'');
   $wrapper=SkinCommentsPage($article,$comments,$template,$_SERVER['SCRIPT_NAME'],$range);
   $content=str_replace("{notice}",'',$wrapper);
   $xout.=$content;
   unset($content);

 }
 else if ($action=='addcomment')
 {
   if ($script['comments']['enabled']!="ON")
   {
    $wrapper=SkinMessage('$__msg_commentsdisabled',$template);
    $xout.=$wrapper;
   }else
   {
   $author=$_POST['author'];
   $email=$_POST['email'];
   $comment=$_POST['comment'];
   $newsid=$_GET['newsid'];
   $newsarch=$_GET['newsarch'];
   if (empty($author) or empty($comment) or !VerifyCaptcha() or !VerifyCommentLength())
   {
     $notice='';
     if (empty($author)){$notice='$__msg_forgotname';}
     if (empty($comment)){if ($notice==''){$notice='$__msg_forgotcomment';}else {$notice.='<BR />$__msg_forgotcomment';}}
     if (!VerifyCaptcha()){if ($notice==''){$notice='$__msg_wrongcaptcha';}else {$notice.='<BR />$__msg_wrongcaptcha';}}
     if (!VerifyCommentLength()){if ($notice==''){$notice='$__msg_longcomment';}else {$notice.='<BR />$__msg_longcomment';}}
     $comments=GetComments($newsarch,$newsid,$range);
     $article=FullNews($newsarch,$newsid,'');
     $wrapper=SkinCommentsPage($article,$comments,$template,$_SERVER['SCRIPT_NAME'],'1-25');
     $content=str_replace("{notice}",$notice,$wrapper);
     $xout.=$content;
   }
  else {
     $post=1;
     if (IsUser($author))
     {
       if ($author!=$_COOKIE['xusername']){$post=0;}
        else
        {
         if (ValidateLogin($author,$_COOKIE['xpassword'])==1)
         {
          $post=1;
         }
        else
        {
         $post=0;
        }
       }
     }
    if ($post==1)
    {
     PostComment($newsarch,$newsid,$author,$email,$comment);
     $wrapper=SkinMessage(LanguageField('msg_commentposted',''),$template);
     $wrapper=str_replace("{LINK}",$_SERVER['SCRIPT_NAME']."?xnewsaction=getcomments&newsarch=".$newsarch."&newsid=".$newsid,$wrapper);
     $xout.=$wrapper;
    } else
    {
     $xout.= SkinMessage(LanguageField('msg_requirelogin',''),$template);
     $xout=str_replace('{REGNICK}',$author,$xout);
    }
   }
  }
 }
else if ($action=='fullnews')
{
  $newsid=$_GET['newsid'];
  $newsarch=$_GET['newsarch'];
  $article=FUllNews($newsarch,$newsid,'');
  $tpl=file_get_contents($script['paths']['file']."templates/$template/full-news-article.html");
  $c=SkinFullNewsArticle($article,$tpl);
  $xout.=$c;
}

if ($script['rss']['enabled']=="YES")
{
$feedlinkcode='<a href="'.$script['paths']['url'].'news.xml"><img src="'.$script['paths']['url'].'inc/img/rss.gif" border="0"></a>';
$feedlinkcode.='<a href="http://fusion.google.com/add?feedurl='.$script['paths']['url'].'news.xml"><img src="'.$script['paths']['url'].'inc/img/rss-google.gif" border="0"></a>';
$feedlinkcode.='<a href="http://e.my.yahoo.com/config/cstore?.opt=content&.url='.$script['paths']['url'].'news.xml"><img src="'.$script['paths']['url'].'inc/img/rss-yahoo.gif" border="0"></a>';
$xout=str_replace("{FEEDLINKS}",$feedlinkcode,$xout);
}
$xout=str_replace("{FEEDLINKS}","",$xout);
$xwrapper=str_replace("{CONTENT}",$xout,$xwrapper);
$xout=$xwrapper;
OutputWrapper($xout,1);
unset($content,$wrapper,$action,$xout);

?>
 
Odgovor na temu

Miroslav Ćurčić
ex mVeliki
Novi Sad

Član broj: 19034
Poruke: 1118
*.dynamic.sbb.co.yu.



+19 Profil

icon Re: php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)20.01.2007. u 21:19 - pre 210 meseci
A da dodaš:
Code:

$_GET['xnews-catlist']= 2;

pre include-a ?
"The quieter you become, the more you are able to hear."
Blog | PowerCMS
 
Odgovor na temu

[es] :: PHP :: php-kako ubaciti sadrzaj u stranu... (tamo gde INCLUDE nije dovoljan)

[ Pregleda: 3056 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.