1
svenw
WF-Setions enhancement - article.php
  • 2003/12/5 8:31

  • svenw

  • Just popping in

  • Posts: 5

  • Since: 2003/12/4


As you have possibly have seen, we are including HTML-files directly into WF-Sections. However, the code is not stripping the header and html-tags. I found that in the freecontent-module some simple, but effective functions are used to reduce the HTML-content to only the body part. This is what I included: in article.php at line

========= Start of the code ===============

# this is the original line:
#
# $articletag['maintext'] = fread($fp, filesize($maintextfile));
// NEW!
$htmlData = fread($fp, filesize($maintextfile));

$htmlData = str_replace("\r\n", " ", $htmlData);
$htmlData = str_replace("\n", " ", $htmlData);
$htmlData = preg_replace("/\s+/", " ", $htmlData);

if (preg_match('|<\s*head\s*>(.*)<\s*/\s*head\s*>.*?<\s*body\s?.*?>(.*)<\s*/\s*body\s*>|i',$htmlData, $match) !==0) {
$headPart = $match[1];
$bodyPart = $match[2];

preg_match_all('|<\s*link\s+.*?>|i', $headPart, $match);
$headPart_tmp = implode($match[0],' ');

preg_match_all('|<\s*script\s+.*?>\s*<\s*/\s*script\s*>|i', $headPart, $match);
$headPart = $headPart_tmp.implode($match[0],' ');

} else {
$headPart = '';
$bodyPart = '';
}
$articletag['maintext'] = $bodyPart;
// END OF NEW

========= End of the code ===============

Perhaps this can end up in the mainstream, but otherwise other people can include this themselves.

Have fun!

2
svaha
Re: WF-Sections enhancement - article.php
  • 2003/12/5 10:33

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


Sven thnx again,
I've been trying to get html into WF-section but stumbled across the problems you described. That's why I've used CJay content to import my html files.
Maybe you also know an answer to a question I asked here several times : Is it possible to display only article text in WF-section.
I want to use WF-section as article manager and want to include files from the news section and from CJay.
But when I do this I allways get the header of my site displayed. I want to see only the header of WF-section, the article as it is written and the footer of WF-section.
Could this be possible?

Aloha

3
svenw
Re: WF-Sections enhancement - article.php
  • 2003/12/5 14:23

  • svenw

  • Just popping in

  • Posts: 5

  • Since: 2003/12/4


Aloha Aloha,
I am unsure what you want to achieve. Perhaps you can use the 'index page management' (move over the wf-sections menu and the option is visible (not in the main admin index of wf-sections!!)). At least you can disable the image.

Also from the template menu ('system admin - templates'), you can change the templates for wf-sections. Perhaps you can change wfsection_article.html and/or wfsection_htmlart.html. Use reply to tell me if this solves your problem.

Good luck!

4
svaha
Re: WF-Sections enhancement - article.php
  • 2003/12/5 14:50

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


Well,
for instance : I made an article in the news section with this id : http://www.rainbowshaman.com/modules/news/article.php?storyid=18
Now I want this article to be 'managed' by WF-section.
I tried to work with iframes, or html commands, but allways I see not only the article but also the header of the news section (is logical if you look at the link)
What I want is only the article text/pictures and not the news header/footer, so it looks like it is an article made in WF-section.
Hope this is more clear

Aloha

5
Catzwolf
Re: WF-Setions enhancement - article.php
  • 2003/12/20 6:19

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


This has been done for the next version of WF-Sections and will be used for other modules that use Static HTML files

6
svaha
Re: WF-Setions enhancement - article.php
  • 2003/12/20 21:37

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


Wauw Great cant't hardly wait to get my hands on this!!

Aloha

Login

Who's Online

1019 user(s) are online (271 user(s) are browsing Support Forums)


Members: 0


Guests: 1019


more...

Donat-O-Meter

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

Latest GitHub Commits