To jest tylko wersja do druku, aby zobaczyć pełną wersję tematu, kliknij TUTAJ
phpBB2 by Przemo
Support forów phpBB2 modified by Przemo

Portal - [ FAQ ] Jak stworzyć nową stronę w portalu

paul2 - 07-01-2008, 13:22

z!omek_PL

php,
zmienilem w kodzie portal.php tak aby bral portal_page[numer].php.

portal_page1.php:
Kod:
<table class="forumline" border="0" cellpadding="2" cellspacing="1" width="100%">^
<tbody><tr>
<td class="catHead" height="25"><span class="genmed"><b><center>Testowa strona</center></b></span></td>
</tr>
<tr>
<td class="row1" align="left"><span class="gensmall"><center><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr valign="top"><td valign="top">
<center>
      Tu powinno byc slowo test:
<?php
echo "test";
?>
   </center>
</td></tr></tbody></table></center></span></td>
</tr>
<tr>
<td class="row3" align="left"><span class="gensmall"></span></td>
</tr>
</tbody></table>


slowo test sie nie pojawia

z!omek_PL - 07-01-2008, 13:32

portal.php wczytuje i wyświetla ZAWARTOŚĆ pliku w odpowiednim miejscu, a nie przetwarza jego zawartości.

//edit:

możesz zrobić jeszcze tak:
Kod:

w portal.php

$template->assign_vars(array(
        'OWN_BODY' => file_get_contents('./portal_page' . $where . '.html'),
        'BEGIN_NEWS' => '<!--',
        'END_NEWS' => '-->')
    );

zmien na:

$template->assign_vars(array(
        'OWN_BODY' => include('./portal_page' . $where . '.php'),
        'BEGIN_NEWS' => '<!--',
        'END_NEWS' => '-->')
    );


jednak, includowanie pliku może być niebezpieczne
NA WŁASNĄ ODPOWIEDZIALNOŚĆ

paul2 - 07-01-2008, 13:36

Czyli musze to rozwiazac inaczej, dzieki za odpowiedz :)
BastaO - 08-01-2008, 20:33

A mi po edytowaniu portal.php wyskakuje taki błąd :

Kod:
Parse error: syntax error, unexpected T_IF, expecting ')' in /home/sebastianb/public_html/portal.php on line 1094


A w lini 1094 nie ma tego ')'

Ta linia wygląda tak :

Kod:
if ( $allowed_values[$where] != '' && file_exists('./' . $allowed_values[$where]) )



Pomożcie :|

paul2 - 09-01-2008, 09:01

no wlasnie.. nie ma, a on sie go spodziewal, sprawdz czy gdzies wczesniej nie ma nie zamknietego nawiasu.
gaku - 09-01-2008, 09:02

BastaO, wklej 5 linijek przed i 5 po tej lini
BastaO - 09-01-2008, 16:12

Kod:
$where = $HTTP_GET_VARS['show'];
$allowed_values = array(
    '1' => 'portal_page1.html',
    '2' => 'portal_page2.html',
    '3' => 'portal_page3.html',
    '4' => 'portal_page4.html',
    '5' => 'portal_page5.html',
    'ranking08' => 'ranking08.html',

                    'strona1' => '/katalogjakistam/strona1.html',
       
if ( $allowed_values[$where] != '' && file_exists('./' . $allowed_values[$where]) )
{
    if ( !function_exists('file_get_contents') )
    {
        function file_get_contents($filename)
        {
            $file = @fopen($filename, 'rb');
            if ( $file )
            {
                if ( $fsize = @filesize($filename) )
                {
                    $data = @fread($file, $fsize);


Pomozcie ;(

[ Dodano: 10-01-2008, 20:46 ]
No co ? Nikt nie pomoze ? ;(

koziolek - 11-01-2008, 20:42

znajdź:
Kod:
$allowed_values = array(
    '1' => 'portal_page1.html',
    '2' => 'portal_page2.html',
    '3' => 'portal_page3.html',
    '4' => 'portal_page4.html',
    '5' => 'portal_page5.html',
    'ranking08' => 'ranking08.html',

                    'strona1' => '/katalogjakistam/strona1.html',
i zamień na:
Kod:
$allowed_values = array(
    '1' => 'portal_page1.html',
    '2' => 'portal_page2.html',
    '3' => 'portal_page3.html',
    '4' => 'portal_page4.html',
    '5' => 'portal_page5.html',
    'ranking08' => 'ranking08.html',
    'strona1' => '/katalogjakistam/strona1.html'
);
:P

BastaO - 12-01-2008, 00:01

Dodalem i jest ok, ale nawet jak wejde przez portal page :
Kod:

http://www.g-fifa.com/portal.php?show=3/


To zamiast tego co ja chce to jest caly czas storna glowna portalu ;/ ? ;( pomozcie

koziolek - 12-01-2008, 12:07

to chyba powinno być beż ukośnika ;)
BastaO - 12-01-2008, 19:28

A no racja :P dalem w portal.php cos takiego :

Kod:
 '1' => 'portal_page1.html',
    '2' => 'portal_page2.html',
    '3' => 'portal_page3.html',
    '4' => 'portal_page4.html',
    '5' => 'portal_page5.html',
    'ranking08' => 'ranking08.html',
    'ranking08' => '/ranking08.html/ranking08.html'
);       
 

i jak wchodze z adresu:
Kod:

http://www.g-fifa.com/portal.php?show=ranking08


To tego nie ma :| a dodalem strone na ftp ranking08.html

Moze zle to uzupelnilem ?

gaku - 12-01-2008, 20:17

BastaO,
Kod:
   'ranking08' => 'ranking08.html',
    'ranking08' => '/ranking08.html/ranking08.html'
Nie sądzisz, że coś jest źle ?

[ Dodano: 12-01-2008, 20:25 ]
no ale mniejsza o to, już znalazłem problem (nie testowałem)
znajdź
Kod:
$where = intval($HTTP_GET_VARS['show']);
zmień na
Kod:
$where = $HTTP_GET_VARS['show'];

i zmień
Kod:
if ( $where && file_exists('./portal_page' . $where . '.html') )

na
Kod:
if ( $where && file_exists('./' . $where . '.html') )


i jeszcze
Kod:
    $template->assign_vars(array(
        'OWN_BODY' => file_get_contents('./portal_page' . $where . '.html'),
        'BEGIN_NEWS' => '<!--',
        'END_NEWS' => '-->')
    );

na
Kod:
    $template->assign_vars(array(
        'OWN_BODY' => file_get_contents('./' . $where . '.html'),
        'BEGIN_NEWS' => '<!--',
        'END_NEWS' => '-->')
    );

Nie sprawdzałem, więc zrób kopie plików

BastaO - 12-01-2008, 22:10

[quote="gaku"]BastaO,
Kod:
   'ranking08' => 'ranking08.html',
    'ranking08' => '/ranking08.html/ranking08.html'
Nie sądzisz, że coś jest źle ?

Hmm... Niewiiem :oops: Możesz mi podać jak bedzie poprawnie ? ;(

gaku - 12-01-2008, 22:45

BastaO, zrób sobie kopie tego pliku i spróbuj mojego rozwiązania
BastaO - 12-01-2008, 23:20

[quote="gaku"]
znajdź
Kod:
$where = intval($HTTP_GET_VARS['show']);
zmień na
Kod:
$where = $HTTP_GET_VARS['show'];

i zmień
Kod:
if ( $where && file_exists('./portal_page' . $where . '.html') )

na
Kod:
if ( $where && file_exists('./' . $where . '.html') )


Cytat:


W moim portal.php nie ma takiego kawalku :roll: :/



Powered by phpBB modified by Przemo © 2003 phpBB Group