Support the ongoing development of Laravel.io →
Requests Input Views
Last updated 1 year ago.
0

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.)

Last updated 1 year ago.
0

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??

Last updated 1 year ago.
0

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.

Last updated 1 year ago.
0

And if you could post what code you have so far, it will assist in someone helping.

Last updated 1 year ago.
0

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

Last updated 1 year ago.
0

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;
        }
    }
Last updated 1 year ago.
0

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!

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

kbadgley kbadgley Joined 20 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.