FORUMS CLOSED DUE TO SPAM. YOU STILL CAN ADD POST!

Using snippit's

Feed 2 posts, 2 voices

Avatar
1 posts

Hello all, I have a quick question that I hope can be answered.

First off, my site was built before I thought of using Frog CMS, I added the Frog CMS for the news section only.

My problem is, that on the home page I have a feature box where I would like to have a recent article snippit I created, called into it, but since the page is outside of the Frog application, I’m not sure what include code should look like. Does anyone know how I can include a snippit I created, to the home page if its outside of the CMS folder?

 
Avatar
180 posts

I think you can create page like…

<?php
foreach($this->find('/articles/') as $page){
echo '<div class="article-item"><h2>'. $page->link(); .'</h2><div class="article-descr">'. $page->content() .'</div></div>';
}
?>

Note that you should use layout “none” for this page.

At first page (not FrogCMS page – simple php page) you can include this content like:

<?php include('http://yoursite.com/path_to_frog/articles_simple/'); ?>

Or

<?php
$articles_content = file_get_contents('http://yoursite.com/path_to_frog/articles_simple/');
echo($articles_content);
?>

Or you can use AJAX-request that will be load yor articles from FrogCMS page.

Or… :) You can make page that will be like JavaScript page with articles content:

<?php
foreach($this->find('/articles/') as $page){
echo 'document.write(\'<div class="article-item"><h2>'. $page->link(); .'</h2><div class="article-descr">'. $page->content() .'</div></div>\');';
}
?>

And require this JS to your page without Frog:

<script src="http://yoursite.com/path_to_frog/articles_simple/" type="text/javascript"></script>

Or…! You can use CURL :) heh…

 
Avatar
1 posts

Thank you so much!