Add new pages?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
JohnDubya
Posts: 9
Joined: Sat Jul 08, 2006 12:14 am

Add new pages?

Post by JohnDubya »

Is there a way to add a new page to the mix? I have all my pages used (add.php , index.php , help.php , etc.), but I want to add a page that has links but is still able to use the PHP code to include the template that I would make, the users online, etc. How can I do this?

Again, thank you guys so much for your help! You all are awesome!
JDub

Find useful information online for a ton of different topics!
http://www.johnnyzone.com
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

it's quite easy:

1. Built a template and call it e.g. test.tpl and place it in /template

2. Built the PHP file called test.php like contact.php and save it in the root of phpMyFAQ

3. Register the variable "test" in inc/constants.php in $allowedVariables.

4. Now you can access the new page via index.php?action=test

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
softairwelt
Posts: 21
Joined: Mon Feb 20, 2006 3:55 pm

Re:

Post by softairwelt »

Thorsten wrote: 1. Built a template and call it e.g. test.tpl and place it in /template
2. Built the PHP file called test.php like contact.php and save it in the root of phpMyFAQ
3. Register the variable "test" in inc/constants.php in $allowedVariables.
4. Now you can access the new page via index.php?action=test
Das hatten wir in unserer alten Version so umgesetzt - lief super.

Kann es sein, dass in 2.8.1 das nicht mehr geht?
Sobald ich eine weitere Variable registriere und die dann über den link aufrufe bekomme ich sofort eine weiße Seite.
index.php?action=meine-seite
meine-seite.php ist im faq root
meine-seite.tpl ist in template

in der .php haben wir die links als html in der Var. testContent gespeichert und geben die so aus

$tpl->processTemplate ('writeContent', array(
'testTitle' => $testTitle,
'testContent' => $testContent
)
);
$tpl->includeTemplate('writeContent', 'index');

hat einer Rat?

danke und grüße
mathias
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Add new pages?

Post by Thorsten »

Hi,

in der Version 2.8 ist die constants.php im Ordner config/

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
softairwelt
Posts: 21
Joined: Mon Feb 20, 2006 3:55 pm

Re: Add new pages?

Post by softairwelt »

Im ordner /config habe ich die constants.php auch geändert.
Die selbsterstellte Seite bleibt trotzdem leer.
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Add new pages?

Post by Thorsten »

Hi,

ah, sorry, die Template-Klasse hatte sich mit der 2.7 oder 2.8 noch geändert, es muss so aussehen_

Code: Select all

$tpl->parse ('writeContent', array(
'testTitle' => $testTitle,
'testContent' => $testContent
)
);
$tpl->merge('writeContent', 'index');
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
softairwelt
Posts: 21
Joined: Mon Feb 20, 2006 3:55 pm

Re: Add new pages?

Post by softairwelt »

Hi,

danke,
- fast angekommen, die Seite wird gezeigt.
- Der Titel (testTitle) wird korrekt ausgegeben

Das Inhaltsarray wird so ausgegeben:
{testContent}

Kann ich keine Arrays mehr ausgeben?
In der bisher genutzten selbst erstellten .php hatte ich testContent so aufgebaut:
$testContent = '<br><b>Hier einige Links, die wir für besonders wichtig halten:</b><br><br>';
$testContent .= '<ul>';
$testContent .= '<li><a href="link">wichtiger link 1</a></li>';

usw.

wenn ich alles in einer Zeile habe, wird es ausgegeben.
$testContent = '<br><b>Hier einige Links, die wir für besonders wichtig halten:</b><br><br>';

wegen der Übersichtlichkeit der Datei würde ich das gerne mir den vielen Zeilen weiter machen,

muss ich da noch was anders machen?

vielen dank
mathias
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Add new pages?

Post by Thorsten »

Hi,

doch, sollte so klappen, siehe zB contact.php und contact.tpl

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
softairwelt
Posts: 21
Joined: Mon Feb 20, 2006 3:55 pm

Re: Add new pages?

Post by softairwelt »

Hi Thorsten,

hm, klappt nicht,
die Datei nun mal minimiert

------ komplett ------------
<?php
$testTitle = 'wichtige Links';
$testContent = 'Hier einige Links, die wir für besonders wichtig halten';

$tpl->parse ('writeContent', array(
'testTitle' => $testTitle,
'testContent' => $testContent
)
);
$tpl->merge('writeContent', 'index');
?>


Der testTitel wird korrekt ausgegeben,
der Inhalt von testContent wird nicht ausgegeben sondern es kommt auf der Seite:
{testContent}

Falls Du´s live sehen willst, meine Seite kennst Du ja ;)
danke und grüße
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Add new pages?

Post by Thorsten »

Hi,

ja, schon, aber wo da? :-)

Viele Grüße
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
softairwelt
Posts: 21
Joined: Mon Feb 20, 2006 3:55 pm

Re: Add new pages?

Post by softairwelt »

Links, zweiter link von oben
- Wichtige Links
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Add new pages?

Post by Thorsten »

Hi,

hm, schick mir die Dateien doch mal per Mail bitte.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
softairwelt
Posts: 21
Joined: Mon Feb 20, 2006 3:55 pm

Re: Add new pages?

Post by softairwelt »

Thorsten wrote: in der Datei ist ein kaputter Umlaut:
$testContent = 'Hier einige Links, die wir f�r besonders wichtig halten';
Besten Dank Thorsten, das habe ich im Editor nicht gesehen!!

Jetzt läufts wie geschmiert....

grüße
mathias
mkz4j4
Posts: 4
Joined: Mon Oct 21, 2013 7:26 am

Re: Add new pages?

Post by mkz4j4 »

Uh und ich such mir nen Wolf, da ich nach der Anleitung in FAQ vorgegangen bin.

Danke für den Tipp :)
Post Reply