We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14867
    • 65 Posts
    I have some PHP code and i can’T manage to include it to my page.
    i have other PHPs includet as chunks but this one doesn’t work

    here is the code... maybe the format is wrong or sth else....
    form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
    	<input type="text" name="newURL" size="75"><input type="submit" value="- OK -" />
    </form>
    
    
    <?php
    if (!empty($newURL)) {
    	 
    	 
    	 if(preg_match("/^(www.)/i", $newURL))
    	 	{
    	 	echo '<iframe name="meinframe" id="meinframe" width="600"
    			height="700" scrolling="auto" frameborder="0" src="http://';
    		echo $newURL;
    		echo '">';
    		}
    	 
    	 if(preg_match("/^(http:\/\/)/i", $newURL))
    	 	{
    	 	echo '<iframe name="meinframe" id="meinframe" width="600"
    			height="700" scrolling="auto" frameborder="0" src="';
    		echo $newURL;
    		echo '">';
    		}
    		
    	 else
    	 	{
    	 	echo '<iframe name="meinframe" id="meinframe" width="600"
    			height="700" scrolling="auto" frameborder="0" src="http://www.';
    		echo $newURL;
    		echo '">';
    		}
    	 
    
    
    
    
    }
    
    else {
    	echo "keine Seite geladen - Adresse Eingeben";
    }
    
    ?>
    
      42
    • PHP code goes in snippets, and must be all php code, while chunks can only contain HTML, as they put into your page directly by the MODx engine.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 14867
        • 65 Posts
        so i have to mahe a chunk and a snippet ... ok ... got that. thank you. smiley
          42