PHPWCMS is changing code

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
B1234
Posts: 5
Joined: Wed 12. Dec 2012, 22:15

PHPWCMS is changing code

Post by B1234 »

Hello!

I was wondering if you guys could help me.

I use PHP scandir to read out a dir and echo a few links, nothing too fancy.
On my own server, without PHPWCMS, it works fine. But with PHPWCMS is does partially.

The filenames are echo'ed great without PHPWCMS but it seems that somewhere in the code it is changing the dates in the filenames.
For example it should echo this:

12_ December 2010 - webversie.pdf

But instead it echo's this:
12_" december 2010 - webversie.pdf

And by doing that it makes the <a href tag confused. Changing the code to ' and other things didnt work.

My question is how can I make sure that PHPWCMS doesn't change my code. Outside PHPWCMS, running the PHP directly, worked on 2 different servers.

Thank you!

Regards,
Bas
User avatar
Oliver Georgi
Site Admin
Posts: 9889
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: PHPWCMS is changing code

Post by Oliver Georgi »

maybe you misunderstood how to use. Hard to tace your problem without knowhing what content part, what kind of code. Use a frontend render script and replace a replacement tag… Inline PHP is not recommend and you should understand what happens. You cannot use it in HTML content part because text is html encoded then…
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
B1234
Posts: 5
Joined: Wed 12. Dec 2012, 22:15

Re: PHPWCMS is changing code

Post by B1234 »

Thank you for the reply.

The code is not clean, but works outside PHPWCMS.

Code: Select all

<?php
//Tekst

echo "<font size=\"2\" face=\"Verdana\">
Het KK’tje is het clubblad dat de Kameleon Kinheim eens in de zoveel tijd uitgeeft. Een vaste verschijningsperiode is er niet, maar we proberen er om de paar maanden eentje uit te geven.
<br><br>
Op deze pagina vind je het archief met alle KK’tjes die tot nu toe zijn uitgegeven sinds het eerste exemplaar uit maart 2007. Telefoonnummers en e-mail adressen zijn geblindeerd, aangezien er over de jaren functies zijn verschoven en om de privacy van onze leden te waarborgen. Wanneer je een telefoonnummer of e-mailadres nodig hebt, raadpleeg dan de contactpagina van de website.
<br><br>
<strong>Archief:</strong><br> 
";


//KKtje Archief uitlezen


$bestanden = scandir("../archiefwebsite/");

$huidigjaar = "";

foreach ($bestanden as $name) {
	$naam = explode(".pdf", $name);
	
	//echo var_dump($name);
	
	if(!$naam || !$name || $naam=="." || $name=="." || $naam==".." || $name==".."){}else{
		
	$bestandsnaam = $naam[0];
	
	$tekstweg = str_replace(" - webversie", "", $bestandsnaam);
	$dingweg = str_replace("_", " ", $tekstweg);
	
	$bn = explode(" ", $dingweg);
	
	$nummer = $bn[0];
	$weergeven_naam = $bn[2]." ".$bn[3];
	
	$jaar = $bn[2];
	
	//echo " ".$name." <br>";
		
    echo "<br /><a href='http://www.kameleonkinheim.nl/wcms/archiefwebsite/".$bestandsnaam.".pdf' target='_blank'>".$weergeven_naam."</a>";
	}
}

echo "
</font>";

?>
Content type is external content (Externe content in Dutch)
Custom path or url is http://www.kameleonkinheim.nl/wcms/kktj ... tlezen.php
By opening that like directly you'll see that it works. Within phpwcms it does not. the page within phpwcms is hidden at the moment..

Thank you for your help I hope it's a little bit more clear.
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: PHPWCMS is changing code

Post by juergen »

just remember, having PHP inside a php rendering engine is not as easy as copy & paste.

You have to pass this through the var which does all the rendered output ...

$conten['all'] ....

you will find examples in /frontend_render/ dir

not shure if {PHP:....} tag is still alive, which might do nearly the same for you

http://www.phpwcms-docu.de/system_tags.phtml
User avatar
axelko
Posts: 138
Joined: Mon 27. Feb 2006, 22:51
Contact:

Re: PHPWCMS is changing code

Post by axelko »

Hi,

Why not just upload the 5 pdf files in the phpwcms file center and use the content part 'lijst met bestanden uit bestandsbeheer' to place the pdf files on the right place/page? Easy solution with standard phpwcms functionality.

Kind regards,

Axel
-------------------------------
B1234
Posts: 5
Joined: Wed 12. Dec 2012, 22:15

Re: PHPWCMS is changing code

Post by B1234 »

Hey Axelko,

Because in reality it's 30+ pdf's. I would like to drop them in a folder via FTP and let the script echo them on the website. Less work for me.

Bas
User avatar
Oliver Georgi
Site Admin
Posts: 9889
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: PHPWCMS is changing code

Post by Oliver Georgi »

Do not include the script, choose second option: own path/file or URL and use the full qualified URL from your post here. Otherwise it include but not eval the PHP code.

But this function has several security related things built-in. Better use frontend render.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply