Entirely new to notepad++....and some questions!



  • This is the first time I’m playing around with notepad++.

    Some things I understand some not.

    For example I load a file with a php extemsion that includes mostly HTML code but additionally some lines of JavaScript and PHP.

    Modifying the file and launching it in Firefox all of the HTML code is executed properly and the JavaScript part too works fine but the PHP code seems not to be executed.

    PHP is used to display information about the date the file was modifyed last and a breadcrumb navigation on top.

    Original PHP code:
    <?php
    $an=“Aktuell: “;
    $home=“http://hatchcanyon.eu/”;
    $pie=explode(”/”,"$_SERVER[PHP_SELF]");
    $tr=" > “;
    $b=count($pie);
    echo $an.”<a href="".$home."" class=“grey”>Home </a>";
    for($a=1;$a<$b-2;$a++){
    $ta=$ta.$pie[$a]."/";
    echo $tr."<a href="".$home.$ta."" class=“grey”>".ucfirst($pie[$a])." </a>";}
    $file=explode(’.’,ucfirst($pie[$b-1]));
    //echo “<b>”.$tr.$file[0]."</b>";//
    ?>

    Displayed as:

    “; $b=count($pie); echo $an.“Home “; for($a=1;$a<$b-2;$a++){ $ta=$ta.$pie[$a].”/”; echo $tr.”".ucfirst($pie[$a])." “;} $file=explode(’.’,ucfirst($pie[$b-1])); //echo “”.$tr.$file[0].”";// ?>

    What do I do wrong?



  • @hatchcanyon

    What do I do wrong?

    When using Launch in … Npp starts the related process, like firefox,
    and provides the current document as the first parameter. So something like

    firefox “C:\my_scripts\my_test.php”

    That’s it. Nothing more.

    If the webpage doesn’t look like you expect than something within your code is wrong
    or the assumption how it works.
    In your case it is the assumption that php code gets executed within firefox browser
    but this isn’t the case. Php code runs on the webserver and the resulting html
    code is transferred to the web browser.
    So you need to setup a web server with php support and open the files in firefox accordingly.

    Cheers
    Claudia



  • Thank you very much!

    Sure I forgot that PHP is server executed. My fault!

    I have an xAMMP - can I use this as a server and how to communice between Notepad++, XAMMP and firefox? Sorry I#m not very educated with these topics.

    By the way the PHP code mentioned works on our website for mor than 6 years flawless.

    Thanks in advance
    Rolf



  • @hatchcanyon

    I have an xAMMP - can I use this as a server and how to communice between Notepad++, XAMMP and firefox?

    Yes, you can use whatever webserver you want, it just matters how you call the browser.
    You either can use the Run from the run menu with something like

     INSTALLATION_PATH\YOUR_BROWSER.exe http://localhost…/$(FILE_NAME)
    

    where $(FILE_NAME) gets automatically replaced by the filename of the current opened document
    or
    you edit Shortcuts.xml, which is the file holds, amongst others, the configuration how
    Launch in… gets called. Use again http://localhost…/$(FILE_NAME) as the parameter to
    the browser
    or
    you can use npp_exec plugin which offers additional features like you want to start the webserver in advance etc…

    Cheers
    Claudia


Log in to reply