<?php
require_once('functions.php');
//display links from xml
$links = simple_load_file('links.xml');
foreach($links as $link){
$name = $link['name'];
$ref = $link->loc;
echo "<a href='".$ref."' class='navigation'>".$name."</a>";
}
//Display login boxes if user hasnt logged in
if((!isset($_SESSION['validUser'])) || ($_SESSION['validUser'] != true))
{
?>
//code for showing boxes.....
In the browser, it displays the folowing ;
loc; echo " ".$name." ";} //Display loginboxes.........all the way to != true)) { ?>
When I test this on XAMPP locally it works as intended, but using Azure it produces this.
It appears as if it's reading the '->' as a closing tag for my php. Anyne encounter something like this?
I never did get to find the exact problem, as the project was abandoned. however, as suggested it is most likely a configuration issue from within Windows Azure.
Related
I'm having one of those moments where I know I'm so close, and probably missing something super minor that's causing this to not work.
I'm using a pre-built theme, with an if statement for including or not including a link. What I want to do it put an if statement inside of THAT differentiating between internal and external links, opening external links in a new tab.
This is the portion I'm specifically working on
if(!empty($parallax_one_service_box->title)){
if( !empty($parallax_one_service_box->link) ){
if($parallax_one_service_box->link_type == 'External'){
echo '<h3 class="colored-text">'.esc_attr($parallax_one_service_box->title).'</h3>';
}else {
echo '<h3 class="colored-text">'.esc_attr($parallax_one_service_box->title).'</h3>';
}
}
else {
if (function_exists ( 'icl_translate' ) && !empty($parallax_one_service_box->id)){
echo '<h3 class="colored-text">'.icl_translate('Featured Area',$parallax_one_service_box->id.'_services_title',esc_attr($parallax_one_service_box->title)).'</h3>';
} else {
echo '<h3 class="colored-text">'.esc_attr($parallax_one_service_box->title).'</h3>';
}
}
}
So it's something along the lines of "if not empty, if external link open in a new tab." I ran it through php code checker, and the code is correct...not missing any brackets or anything. The problem seems to be that it's either opening all in a new tab or opening none in a new tab...it's not differentiating between external and internal. So I'm guessing something is wrong with the "if external" line...
Here's a link to Pastebin with the whole section of code: http://pastebin.com/kmuGiVJv
I have a question about PHP.
Some of function can run, some can not.
For example
<?php
include("LIB_parse.php");
include("LIB_http.php");
# download the page
$web_page = http_get ($target = "http://www.nostarch.com", $referer = "");
$title_incl = return_between($web_page['FILE'], "<title>", "</title>", INCL);
$title_excl = return_between($web_page['FILE'], "<title>", "</title>", EXCL);
echo "title_incl =" .$title_incl;
echo "\n";
echo "title_excl =" .$title_excl;
?>
The result is
title_incl = title_excl =No Starch Press
My espect is
title_incl = No Starch Press
title_excl =No Starch Press
There are two problems in this code.
Firstly, echo "\n"; is not working.
Secondly, the included title's spring was not showed.
Another example, parse_array the meta also got problem.
<?php
include (\"LIB_parse.php\");
include (\"LIB_http.php\");
#$target = \"https://news.google.com.tw/nwshp?hl=zh-TW&tab=wn\";
$web_page = http_get( $target= \"www.twse.com.tw/ch/index.php\", $regerer = \"\");
$meta_tag_array = parse_array($web_page['FILE'], \"<meta\", \">\");
for($xx = 0; $xx<count($meta_tag_array); $xx++)
echo $meta_tag_array[$xx].\"\n\";
?>
The result is nothing, I expect it should show all meta contents in the console.
I am using Eclipse Luna with PHP plug-in.
Also installed appserv2.5.10
Apache 2.2.8
PHP 5.2.6
MySQL 5.0.51b
phpMyAdmin-2.10.3
Please help. Really thanks.
I've encountered a strange thing in one magento installation, I haven't touched it in awhile so they must've added stuff to it.
The issue is: They set the cms page to 'disabled' so that page now yields a 404 error each time it's visited(which is good), but for some reason the links.phtml is still releasing all links, not checking if the page is disabled or not.
So I put this here to test:
<?php $_links = $this->getLinks(); ?>
<?php if(count($_links)>0): ?>
<ul class="links"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php foreach($_links as $_link): ?>
<?php
$cmsCollections = Mage::getModel('cms/block')->getCollection();
$attribute = "title";
$value = $_link['title'];
$cmsCollections->addFieldToFilter($attribute, $value);
$item = $cmsCollections->getFirstItem();
$id = $item->getData('is_active');
if($id == 1){
echo "CMS PAGE ". $value." ACTIVE";
}else{
echo "CMS PAGE ". $value." is INACTIVE";
}
?>
The odd part here is that I keep getting the wrong results ...
I'm no magento expert here so maybe anyone knows how to do this properly in getLinks ? I found no options to filter stuff there unfortunately
Elijah, CMS BLOCk collection should be ...
$cmsCollections=
Mage::getModel('cms/block')->getCollection()->addFieldToFilter('is_active',1);
CMS Page Collection
$CMSpageColl
=Mage::getModel('cms/page')->getCollection()->addFieldToFilter('is_active',1);
If you want a particular CMS block then you can get it using idendifier
$cmsCollections = Mage::getModel('cms/block')->getCollection()->addFieldToFilter('identifier',indefiername);
If you want a particular CMS block then you can get it usign idendifier
$cmspageCollections =
Mage::getModel('cms/page')->getCollection()->addFieldToFilter('identifier',indefiername);
I have installed a plugin (use PHP in posts) for Wordpress, and am having some issues.
Here is my code (though I don't think its the issue)
$usertoget = $_GET['player'];
$partone = "http://website.co.uk/path/to/php/file.php";
if(strlen($usertoget) != 0) {
$parttwo = "&player=";
$partthree = $usertoget;
$finalurl = $partone . $parttwo . $partthree;
print '<iframe src="$finalurl"></iframe>';
}
else {
print "<iframe src='/path/file.php'>";
}
The iframe gets printed perfectly and does what the target file should, but as you can see from this picture, messes up the formatting:
No sidebar;
No footer;
No floating header.
I have noticed that the page source finishes the iframe and does nothing else except close (</body></html>). There is a lot of stuff after it that should appear but doesn't.
Another issue is, using GET requests (/page/hello?player=9 and /page/hello/?player=9) returns a 404. Any ways to resolve this issue?
Does anybody know how I can fix this? I can post any more code if required :)
Any help would be appreciated :D Thanks!
If PHP suddenly stops sending the expected output, it usually means there's a PHP error. Is there anything in your logs? Have you tried turning WP_DEBUG on?
I'm surprised you say the iframe gets printed perfectly. This line
print '<iframe src="$finalurl"></iframe>';
looks wrong to me (though it won't cause PHP to error). If you have single quotes around a string, variables won't be evaluated. See this question for a little more detail.
You have mistake in concatenation of $finalurl .you can check you html its print the $finalurl variable as it is.Its didn't outputted its values .I had check it.So you just have to concatenate the $finalurl variable correctly .Here is your code which i had made corrected.
$usertoget = $_GET['player'];
$partone = "http://website.co.uk/path/to/php/file.php";
if(strlen($usertoget) != 0) {
$parttwo = "&player=";
$partthree = $usertoget;
$finalurl = $partone . $parttwo . $partthree;
print '<iframe src='.$finalurl.'></iframe>';
}
else {
print "<iframe src='/path/file.php'>";
}
if you have any query please comment bellow.
I developed a module to display submenus as stand alone module, every thing works fine untill the sef is enabled, the item id does not change to the correct one
<ul class="list2">
<?php foreach ($items as $row) :?>
<?php
//$router = JSite::getRouter();
if ($router->getMode() == JROUTER_MODE_SEF) {
$link = $router->build($row->link);
$router->setVar('Itemid',$row->id);
echo $_REQUEST['Itemid'];
//$link =$row->alias;
}else {
$link = $row->link.'&Itemid='.$row->id;
}
?>
I tried using the JSITE::route even router->build and tried to reset $_Request['Itemid']
and nothing worked
what I do wrong, any help please ?
found the solution, just need to change the item id before creating the link
$router->setVar('Itemid',$row->id);
$link = $router->build($row->link);
hopfully this will help other developers :)