Asked  7 Months ago    Answers:  5   Viewed   56 times

How would one go about showing PHP code on user end. Sort of like w3School does?

Having lets say a grey area div, and then showing the code in there without activating it?

 Answers

70

You can use html entities &lt;?php in the html it will be rendered as <?php

You can use htmlspecialchars to encode your code to use html entities.

Wednesday, March 31, 2021
 
jakubos
answered 7 Months ago
86

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario: http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm

Related usability ticket: http://youtrack.jetbrains.com/issue/WI-18388

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
 
ojrac
answered 7 Months ago
79

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
 
Nate
answered 5 Months ago
69

It seems that $_SERVER['DOCUMENT_ROOT'] is pointing to C:xampphtdocs, while your scripts are at C:xampphtdocsf, check the value of $_SERVER['DOCUMENT_ROOT'] on your local environment.

edit:

<?php
$rootDir = "";
if(strpos($_SERVER['HTTP_HOST'],'localhost')===FALSE)
{
  //On Production
  $rootDir = $_SERVER['DOCUMENT_ROOT'];
}
else
{
  //On Dev server
  $rootDir = $_SERVER['DOCUMENT_ROOT'].'/f';
}

<?php include($rootDir.'/header.php');?>

<div id="content">
...
</div> <!-- content -->

<?php include($rootDir.'/footer.php') ?>


?>
Saturday, May 29, 2021
 
Blur
answered 5 Months ago
40

Using the same technique you used to display it inline you could try to load the PDF file using an Iframe:

<html>
    <head>
    </head>
    <body>
        <p>some content</p>
        <iframe src="/path/to/your/pdf/script.php"></iframe>
    </body>
</html>
Saturday, May 29, 2021
 
tiny
answered 5 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :