See if this helps:
http://stackoverflow.com/questions/12647424/passing-parameter-to-controller-from-route-in-laravel
I should say, I can get the reference passed, however I cannot figure out how to get the page to use it properly. (How to pass it to said page, so the page knows that it exists, and how to use it.)
I think there is something wrong when it comes to loading the XML file... could it be the path to the XML that is having the problem??
Have you tryed to just temporally put the XML file in controllers folder so it can be opened direct? Only temporary for testing sake. Test your route also by echoing something in controller.
And if you could post what code you have so far, it will assist in someone helping.
I am able to get the variable passed in, via the route, but unable to pass it to the page that I want to use it on...but it seems however that it is having a hard time finding the XML file. Not the variable at this point.
$file = 'Assets/content/pages.xml';
$xml = simplexml_load_file($file);
foreach($xml->page as $page){
if($pagename == $page->name){
echo $page->content;
}
}
I am getting some sort of error in this section of PHP code, saying the following..
simplexml_load_file(): I/O warning : failed to load external entity
Comment out everything except this and Try:
$file = 'Assets/content/pages.xml';
$xml = simplexml_load_file($file);
echo '<pre>';
print_r($file);
echo '</pre>';
echo '<pre>';
print_r($xml);
echo '</pre>';
to see if all is loading up correctly. If not check your path. Fix that first. If loading ok, then recheck your code in here:
foreach($xml->page as $page){
if($pagename == $page->name){
echo $page->content;
}
}
Sweet jesus, I figured it out! For some reason the path required...
public/Assets/content/pages.xml
this is the only time I have needed the "public" directory before the Assets.
Thanks so much for the help Jimgwhit!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community