Sidebar Content Capabilities?

Discuss phpwcms here, please do not post support requests, bug reports, or feature requests! Non-phpwcms questions, discussion goes in General Chat!
Post Reply
Ben
Posts: 558
Joined: Wed 14. Jan 2004, 08:05
Location: Atlanta
Contact:

Sidebar Content Capabilities?

Post by Ben »

I have looked through the forums and have not found a way to dynamically add content to a sidebar, as seen in the right column of the http://www.perical.com homepage. (I am not focussing on the look of this site, simply the side bar concept) If the templates have a main section and a right section, why not add a selector to articles so we can define if they are to be placed in the main content section or the sidebar? Short of doing this, the only other way I can think of to add content in a side bar would be to hard code it in a template, which diametrically opposes the underlying concepts of a content management system. Right? :D
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

There is a more simple solution at the moment to add additional "semi-dynamic" content to any place of phpwcms.

Create external scripts/files with your content and add the {PHP:my_external.php} inside your template at the place where you want to have it. The file does not have to be named .php -> it can have any filename - and content of that include file can be just simple HTML code. And it's very easy to edit such file in your favorite editor offline ;-)

I have something in mind to add functionality for using article's content like {CONTENT:1} -> then you can predefine such content blocks, fill in the replacement tag in your template; and then you can choose such content block from a select menu per content part.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Spirou
Posts: 22
Joined: Fri 2. Jan 2004, 17:07
Location: Finland

Extruding/separating content parts

Post by Spirou »

Oliver Georgi wrote:
I have something in mind to add functionality for using article's content like {CONTENT:1} -> then you can predefine such content blocks, fill in the replacement tag in your template; and then you can choose such content block from a select menu per content part.

Oliver
I tried a similar solution but came to a halt when i tried to create a replacement tag like Olivers suggestion {CONTENT:1}

1. I put my own code into articlecontent.edit.tmpl.php with radiobuttons for position (eg. Position: main O left O right O)
2. added acontent_position into mysql: table phpwcms_acontent (values 1=main, 2=left, 3=right)
3. Inserted acontent_position into article.editcontent.inc.php
4. Inserted acontent_position into act_articletcontent.php
($sql = "UPDATE ".DB_PREPEND."phpwcms_articlecontent SET acontent_position=".intval.........)
5. Added: $content["position"] = intval($_POST["position"]); to article.readform.inc.php

The data is inserted and retrieved from database without any problems. I also tested it by adding acontent_position to content.article.inc.php

$sql_cnt = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_aid=".$row["article_id"]." ".
"AND acontent_visible=1 AND acontent_trash=0 AND acontent_position=1 ORDER BY acontent_sorting, acontent_id;";


This gives the expected result, only content parts with value=1 is shown.
I got stuck when I tried to create a replacement tag like {CONTENT:3} for inclusion in the template (right column)
I tried to write a tag like {CONTENT:3} in content.inc.func.php but it didn't work.

Do I have to write a separate function similar to $content["all"] or does anyone have any better ideas for extracting content parts? The idea is to let the user choose where on the page article content should be added.

In this case an external file like {PHP:....} does not seem to be a very good option if the enduser haven't got any knowledge about html-editors or coding.
Any suggestions?
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

I think it is not useful to create "new" functions. the content.article.inc.php has to be extended -> main goes to $content["all"] and "left"/"right" has to be added to $content["left"]/["right"]. But I do not wish to see content left/right. I think this is no good idea. It is better to use something like 1/2/3... Maybe it is confusing if you do not use left/right.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Spirou
Posts: 22
Joined: Fri 2. Jan 2004, 17:07
Location: Finland

Post by Spirou »

Hi Oliver!

Thanks for spreading some light on my dilemma. Maybe you misunderstood my left/right -concept. My idea was to have radiobuttons with the same field names as in the template insertion form(header, main, footer...), maybe it's less confusing? This is the table I created in phpwcms_acontent:

acontent_position tinyint(1) NOT NULL default '1',

Anything that goes into this table is either one of three numbers 1,2 or 3 this could even be extended with 4 and 5, for header or footer if somenone would like to put content parts in there.

What really confused me was $content=["all"] and $content["main"]. I tried to search for something like $content["articlecontent"] int the code but could not find anything with a resemblance. So my next step would be to insert someting like $content["position2"] and $content["position3"] in content.article.inc.php ?
I guess you mean that they will function the same way as $content["main"] as in the code below.

case 5: $content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);

Now I'm starting to realize why my {CONTENT:..} in content.func.inc.php didn't work :)
In fact it might be easier than I thougt since it's possible to exclude any unwanted parts with the SELECT-syntax in mysql :!: I'll give it a try tomorrow.

Thanks again!
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

;-) I have undestood very well - and know your dilemma.

Sorry - I had to check - it is not $content["all"] - it's $content["main"].

Every content parte/line in content.article.inc.php is added to $content["main"] -> if you use additional {CONTENT:...} a split has to be made when the content part is rendering

Every content part needs a switch case which checks against your radio buttons and adds rendered content to specific {CONTENT:...} var.

Have a look at line 1069 - as sample:

Code: Select all

$content["temp"] = headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
$content["temp"] .= ($crow["acontent_text"]) ? "<br />".nl2br(div_class($crow["acontent_text"],$template_default["article"]["text_class"])) : "";

switch($crow['acontent_position']) {

case 1: $content['pos1'] .= $content["temp"]; break;
case 2: $content['pos2'] .= $content["temp"]; break;
default: $content['main'] .= $content["temp"]; break; // case 0

}
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
adriano
Posts: 165
Joined: Sun 16. Nov 2003, 15:24
Location: Bremerhaven
Contact:

Post by adriano »

What is about this:

I have made a {NEWS} list on the right table part. Its shows me up the numbers of new article I want. But, is there a way to show up the summary of the article too?
Fotos von Norddeutschland und der Nordseeküste
Photos of Northern Germany and the North Sea Coast:
http://www.wackernah.net
Spirou
Posts: 22
Joined: Fri 2. Jan 2004, 17:07
Location: Finland

Article contentparts vs. layout

Post by Spirou »

Hi Oliver!

After much trial and error I finally got it working :D
I can now place article's content part anywhere on the page.

You were right about the radiobuttons in articlecontent.inc.tmpl.php. Naming them left/right/header.. would be confusing since I realized that a replacement tag called {LEFT} don't necessarily have to be in inserted into left textarea-field in a template :idea:

One thing I found a bit annoying was when I tried to put a "plain text"-part in either left or right column, the text folded the same way as in the main column and all of a sudden my right column was more something like 150 px wide even though I had defined this as 80px in Page Layout.

Perhaps this has something to do with $content["main"] and the way it renders? Or maybe the table stretch by percent instead of pixels?

Anyway, it's not really useful to put anyhing but bullet, link, an image or latest news headlines in a column.

Let me know if I can contribute with anything, otherwise - Keep up the good work :wink:
marco

Re: Article contentparts vs. layout

Post by marco »

Spirou wrote:Hi Oliver!

After much trial and error I finally got it working :D
I can now place article's content part anywhere on the page.
I've been waiting for this capability for a while now.

Are you able to place content from the content tree in left or right columns?

In other words, are you able to retrieve from some level e.g. called "Related Articles" from the content tree and place it in the left column and other content e.g. called "related news" or "related links" in the right column?

Can you share the code if it is reusable in any way?

Thanks
marco

Post by marco »

Oliver Georgi wrote:There is a more simple solution at the moment to add additional "semi-dynamic" content to any place of phpwcms.

Create external scripts/files with your content and add the {PHP:my_external.php} inside your template at the place where you want to have it. The file does not have to be named .php -> it can have any filename - and content of that include file can be just simple HTML code. And it's very easy to edit such file in your favorite editor offline ;-)

I have something in mind to add functionality for using article's content like {CONTENT:1} -> then you can predefine such content blocks, fill in the replacement tag in your template; and then you can choose such content block from a select menu per content part.

Oliver

I have not used the latest releases; Can this method retrieve content from the wcms content tree using the wcms replacement tags? Sort of like creating a sub-menu which is used to retrieve some content and place it in the left or right column...

Also, how would one be able to relate the content in the left or right column to the main content?

In other words, if the main (middle) column displays a list of articles, from the content tree and the tree also has a list of related links (or downloads) in the given level, how would you be able to display them in the side columns (left or right)?
empiryk
Posts: 2
Joined: Sun 15. Feb 2004, 19:01

Post by empiryk »

Oliver Georgi wrote:I have something in mind to add functionality for using article's content like {CONTENT:1} -> then you can predefine such content blocks, fill in the replacement tag in your template; and then you can choose such content block from a select menu per content part.
This very goode idea. Your tag-replacement should make some use also with categories of articles - if it is possible. :!:
GH/GP/GSS d- s:+ a38 C++ L+ W+++ N++ K- w O-- M-- PS--- PE+ Y+ PGP++
t--- 5-- X++++ R- b++ DI- D-- G e+++ h---- r+++ z+++
Post Reply