Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
6 - 1 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     
assign('title', $title); $xoopsTpl->assign('content', $content); [/code] -replace with: [code] $content_wrapped= pageWrap($content); $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $content_wrapped); [/code] -find: [code] $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $text); [/code] -replace with: [code] $content_wrapped= pageWrap($text); $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $content_wrapped); [/code] That's it! you can now wrap any .html, .php page you want into your content by simply adding [pagewrap=mypage.php] in your editor.[/quote]" />

Re: tutorial: [pagewrap=mypage.php] in diferent modules
by preachur on 2007/1/12 18:28:30

I want to use this with the new mypage module..... If people could upload and wrap their existing .html websites, that would rock. I just need a hack to allow the upload of .html pages with the DHTML editor. Like the image manager but for .html pages.

It would be even cooler if they could wrap EXTERNAL content with a hack like this.... I.E. wrap a myspace profile into their XOOPS mypage page without needing an iframe.
tutorial: [pagewrap=mypage.php] in diferent modules
by kaotik on 2006/8/4 14:22:53

I originaly posted this in the documentation site, but I'll post here too in case people are searching for this.

I use smartsection (which is excelent) but for certain areas I find content 0.5 more compact and easier to handle small amounts of content. However there is a feature of smartsection that I simply cannot live without: [pagewrap=mypage.php]
So I decided to hack this feature into content. This hack is so simple you can apply it to any article or content manager.

-Go into /modules/content/index.php
-right after the include add this:
le="color: #000000"><?php include "functions.php";

-Now create a file called functions.php
-Add the following code to functions.php
<?php function pageWrap($mytext) { $maxLength=0; $format="S"; $ret = $mytext; $wrap_pos = strpos($ret, '[pagewrap='); if (!($wrap_pos === false)) { $wrap_pages = array(); $wrap_code_length = strlen("[pagewrap="); while (!($wrap_pos === false)) { $end_wrap_pos = strpos($ret, ']', $wrap_pos); if ($end_wrap_pos) { $wrap_page_name = substr($ret, $wrap_pos + $wrap_code_length, $end_wrap_pos - $wrap_code_length - $wrap_pos); $wrap_pages[] = $wrap_page_name; } $wrap_pos = strpos($ret, '[pagewrap=', $end_wrap_pos -1); } foreach($wrap_pages as $page) { $wrap_page_content = loadwrapPage($page); $ret = str_replace("[pagewrap=$page]", $wrap_page_content, $ret); } } return $ret; } function loadwrapPage($file_name) { $page =XOOPS_ROOT_PATH.'/modules/content/content/' . $file_name; if (file_exists($page)){ // this page uses smarty template ob_start(); include ($page); $content = ob_get_contents(); ob_end_clean(); return $content; } } ?>


-go back to index.php
- find:
le="color: #000000"><?php $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $content);


-replace with:
le="color: #000000"><?php $content_wrapped= pageWrap($content); $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $content_wrapped);


-find:
le="color: #000000"><?php $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $text);


-replace with:
le="color: #000000"><?php $content_wrapped= pageWrap($text); $xoopsTpl->assign('title', $title); $xoopsTpl->assign('content', $content_wrapped);


That's it! you can now wrap any .html, .php page you want into your content by simply adding [pagewrap=mypage.php] in your editor.

Who's Online

135 user(s) are online (74 user(s) are browsing Support Forums)


Members: 0


Guests: 135


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits