0

Within my Concrete5 there's a package that contains many single pages, which actually make the core functionality (community connections).

There's one particular page that contains search functionality. Is there any way to take the central part of that page and somehow display it on the homepage, in a div element or similar?

4

2 回答 2

2

You can do this with jquery .load() On the single page, wrap the content you want to import in a div with a unique id. On the home page, add a div to import the content into

// Get the URL of the page
var url = "relative/path/to/page;

// Load the new page into the temp container
// Replace #wrapper with the selector of the element you want to import
$("#import-content").load(url + " #wrapper");
于 2012-10-10T20:07:28.743 回答
1

You should be able to do this by creating a new public function in the single_page's controller that returns whatever you want it to (data that you can then render in HTML, or you could have the controller method itself render an "element" with some data, or just create an HTML string in the controller method itself if you want to totally violate the MVC pattern).

Then you should be able to retrieve that data or markup from your other page like so:

$myController = Loader::controller('/path/to/singlepage'); //<--NOTE this is a C5 URL path (e.g. "slug"), not a server file path!
$myMarkup = $myController->myCustomFunctionIWroteToReturnSomeStuff();
echo $myMarkup;
于 2012-10-06T18:25:46.373 回答