Jump to content


* * * * * 1 votes

Adding Second Content Area Per Page


  • You cannot reply to this topic
8 replies to this topic

#1 jimr451

    Etomite Forum Newbie

  • Member
  • 1 posts

Posted 08 November 2005 - 08:08 PM

Hi,

I see there are some more complex mods to get additional attributes / content areas per page, but I needed something simple. This just adds a second content area to each page. Here's what I did:

1. MYSQL (Run this to alter the table):

mysql> alter table etomite_site_content add content1 mediumtext;


2. Edit manager/actions/dynamic/mutate_content.dynamic.action.php

At line 565 (after </div>):

<!--JR HACK -->
<div class="sectionHeader"><img src='media/images/misc/dot.gif' alt="." />&nbsp;<?php echo "Extra Content Area"; ?></div><div class="sectionBody">
<textarea rows=15 cols=60 name=content1><? echo htmlspecialchars($content['content1']); ?></textarea>
</div>
<!--END JR HACK-->


3. Edit manager/processors/save_content.processor.php

around line 9 add:

// JR HACK
$content1 = addslashes($_POST['content1']);
// END JR HACK

around line 167 modify the SQL statement like so:

$sql = "INSERT INTO $dbase.".$table_prefix."site_content(content, content1, pagetitle, longtitle, type, description, alias, isfolder, richtext, published, parent, template, menuindex, searchable, cacheable, createdby, createdon, editedby, editedon, pub_date, unpub_date, contentType)
VALUES('".$content."','".$content1."', '".$pagetitle."', '".$longtitle."', '".$type."', '".$description."', '".$alias."', '".$isfolder."', '".$richtext."', '".$published."', '".$parent."', '".$template."', '".$menuindex."', '".$searchable."', '".$cacheable."', ".$_SESSION['internalKey'].", ".time().", ".$_SESSION['internalKey'].", ".time().", $pub_date, $unpub_date, '$contentType')";


Around line 270 modify the SQL statement like so:

$sql = "UPDATE $dbase.".$table_prefix."site_content SET content1='$content1', content='$content', pagetitle='$pagetitle', longtitle='$longtitle', type='$type', description='$description', alias='$alias',
isfolder=$isfolder, richtext=$richtext, published=$published, pub_date=$pub_date, unpub_date=$unpub_date, parent=$parent, template=$template, menuindex='$menuindex',
searchable=$searchable, cacheable=$cacheable, editedby=".$_SESSION['internalKey'].", editedon=".time().", contentType='$contentType' WHERE id=$id;";


4. Edit templates and pages

Now you will see an extra (plain textarea) box when editing a page. In your "templates", refer to this as [*content1*] and it will display. I didn't make it use the rich text editor, but I suppose you could easy enough if you wanted.


Hope this makes sense, and is helpful to someone. Solved my problem easy enough!

-Jim

Edited by jimr451, 08 November 2005 - 08:09 PM.


#2 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 08 November 2005 - 10:33 PM

This method, although functional, is not the best way to add content to Etomite... Users are urged not to make changes to the core codebase as you will then lose compatibility with upgrades and you may also be on your own as far as support issues are concerned... Additionally, any major changes to the codebase should be passed by me for verification that unknown problems won't arise... The back-end code is probably too complex for most of the Etomite community to be attempting to modify... For this reason several work-arounds have been created to sesolve such instances... :eto:

#3 vampke

    Likes Etomite Forums!

  • Member
  • PipPip
  • 160 posts

Posted 24 September 2007 - 09:41 AM

I'm wondering if this mod would be ideal for multilingual support...

Edited by vampke, 24 September 2007 - 09:42 AM.


#4 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 24 September 2007 - 01:09 PM

View Postvampke, on Sep 24 2007, 05:41 AM, said:

I'm wondering if this mod would be ideal for multilingual support...
In theory, the Cocoon code base will address multiple content areas and multi-language content support... Progress is moving along much slower than anyone wants at the moment, however, so don't ask when it will be available...

#5 Dolomites

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 03 November 2007 - 06:45 PM

Months...Years? Otherwise I must make this manual modify to my installations... :(

Quote

Now you will see an extra (plain textarea)
And if I wanted to show the editor also in the 2nd text area?

Thank'you!

#6 Dolomites

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 03 November 2007 - 08:32 PM

View Postjimr451, on Nov 8 2005, 10:08 PM, said:

At line 565 (after </div>):

around line 9 add:

around line 167 modify the SQL statement like so:

Around line 270 modify the SQL statement like so:

In the last version these line numbers are not valid...could you update this hack?
Thank'you :)

#7 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 03 November 2007 - 09:37 PM

I would recommend the snippet getSideBar instead. This will allow you to add a second content area based on other unpublished pages. This snippet will do the same as the above hack except it you will be editing the second content area from its own page. It will also allow you installation to be upgraded with future patch releases.

#8 Dolomites

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 04 November 2007 - 09:10 AM

Thank'you! ^_^

#9 darren

    Likes Etomite Forums!

  • Member
  • PipPip
  • 251 posts

Posted 05 November 2007 - 11:41 PM

I agree with Cris, I've used getSideBar to have 3-4 content areas in a page, place different header images in one template (depending on folder structure), etc. its very cool.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users