Content Tag Addon problemo

If you've problems with unsupported - non official ;-) - functionalities use this forum please.
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post by Jérôme »

Here is what i have done until now. If someone wants to try to continue it: Good Luck!

Code: Select all

#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE `phpwcms_articlecontent` ADD `acontent_position` TINYINT(1)  DEFAULT "1" NOT NUL

#
#-----[ OPEN ]------------------------------------------
#

include/inc_act/act_articlecontent.php


#
#-----[ FIND ]------------------------------------------
#

			case 4: //make article public/nonpublic
					$sql = "UPDATE ".DB_PREPEND."phpwcms_article SET article_public=".intval($values[3]).
						   " WHERE article_id=".intval($values[1]).";";
					mysql_query($sql, $db) or die("error while changing article visible/invisible");
					break;

#
#-----[ AFTER, ADD ]------------------------------------------
#

			case 10: //set position
					$sql = "UPDATE ".DB_PREPEND."phpwcms_articlecontent SET acontent_position=".intval($values[3]).
						 " WHERE article_id=".intval($values[1]).";";
						 " WHERE (acontent_uid=".$_SESSION["wcs_user_id"]." OR ".$_SESSION["wcs_user_admin"].")"." AND acontent_id=".intval($values[3]).";";
					mysql_query($sql, $db) or die("error while deleting content position");
					break;

#
#-----[ OPEN ]------------------------------------------
#

include/inc_lib/article.readform.inc.php


#
#-----[ FIND ]------------------------------------------
#

$content["visible"] = intval($_POST["cvisible"]);

#
#-----[ AFTER, ADD ]------------------------------------------
#

$content["position"] = intval($_POST["position"]);

#
#-----[ OPEN ]------------------------------------------
#

include/inc_tmpl/article.editcontent.tmpl.php

#
#-----[ FIND ]------------------------------------------
#

		$set_end					= intval($_POST["set_end"]);

#
#-----[ AFTER, ADD ]------------------------------------------
#

		$position					= intval($_POST["position"]);

#
#-----[ FIND ]------------------------------------------
#

					"article_username='".aporeplace($article["article_username"])."', ".

#
#-----[ AFTER, ADD ]------------------------------------------
#





#
#-----[ OPEN ]------------------------------------------
#

include/inc_tmpl/articlecontent.edit.tmpl.php

#
#-----[ FIND ]------------------------------------------
#

} //Ende Switch und Wahl der passenden Content Typen
	?>
			<tr><td colspan="2"><img src="img/leer.gif" width="1" height="6"></td></tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

			<tr> 
				<td align="right" class="chatlist">Position:</td>
				<td>
					<input name="position" type="radio" id="pos1" value="1" checked <?php is_checked(1, intval($content["position"])); ?>> 1 
					<input name="position" type="radio" id="pos2" value="2"  <?php is_checked(2, intval($content["position"])); ?>> 2 
					<input name="position" type="radio" id="pos3" value="3" <?php is_checked(3, intval($content["position"])); ?>> 3 
					<input name="position" type="radio" id="pos4" value="4" <?php is_checked(4, intval($content["position"])); ?>> 4 
					<input name="position" type="radio" id="pos5" value="5" <?php is_checked(5, intval($content["position"])); ?>> 5 
				</td>
			</tr>
			<tr><td colspan="2"><img src="img/leer.gif" width="1" height="6"></td></tr>
   

#
#-----[ OPEN ]------------------------------------------
#

include/inc_front/content.article.tmpl.php


#
#-----[ FIND ]------------------------------------------
#

									//Bullet List
						case 4:		$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$bullet  = explode("\n", chop($crow["acontent_text"]));
									if(sizeof($bullet)) {
										$content["main"] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
							 			foreach($bullet as $value) {
											if($value) $content["main"] .= "<tr valign=\"top\"><td nowrap>".$template_default["article"]["bullet_sign"]."</td><td>".$value."</td></tr>\n";
										}
										$content["main"] .= "</table>\n";
							 		}
									break;
									//Bullet List Ende

#
#-----[ REPLACE WITH ]------------------------------------------
#

									//Bullet List
						case 4:		$content["bullet"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$bullet  = explode("\n", chop($crow["acontent_text"]));
									if(sizeof($bullet)) {
										$content["bullet"] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
							 			foreach($bullet as $value) {
											if($value) $content["bullet"] .= "<tr valign=\"top\"><td nowrap>".$template_default["article"]["bullet_sign"]."</td><td>".$value."</td></tr>\n";
										}
										$content["bullet"] .= "</table>\n";
							 		}
									
									switch($crow['acontent_position'])
									{ 
										case 1: $content['pos1'] .= $content["bullet"]; break;
										case 2: $content['pos2'] .= $content["bullet"]; break;
										case 3: $content['pos3'] .= $content["bullet"]; break;
										case 4: $content['pos4'] .= $content["bullet"]; break;
										case 5: $content['pos5'] .= $content["bullet"]; break;
										default:	$content["main"] .= $content["bullet"]; break;
									}
									break;
									//Bullet List Ende


#
#-----[ FIND ]------------------------------------------
#
									//Link Liste
						case 5:		$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$link  = explode("\n", $crow["acontent_text"]);
									if(sizeof($link)) {
										$content["main"] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
							 			foreach($link as $value) {
											list($link["name"], $link["link"])   = explode("|", $value);
									 		list($link["link"], $link["target"]) = explode(" ", $link["link"]);
											$content["main"] .= "<tr valign=\"top\"><td nowrap>".$template_default["article"]["link_sign"]."</td>\n";
											$content["main"] .= "<td><a href=\"".$link["link"]."\"".(($link["target"])?" target=\"".$link["target"]."\"":"").">";
											$content["main"] .= html_specialchars( ($link["name"]) ? $link["name"] : $link["link"] )."</a>";
											$content["main"] .= "</td></tr>\n";
										}
										$content["main"] .= "</table>\n";
							 		}
									break;
									//Link Liste Ende

#
#-----[ REPLACE WITH ]------------------------------------------
#

									//Link Liste
						case 5:		$content["link"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$link  = explode("\n", $crow["acontent_text"]);
									if(sizeof($link)) {
										$content["link"] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
							 			foreach($link as $value) {
											list($link["name"], $link["link"])   = explode("|", $value);
									 		list($link["link"], $link["target"]) = explode(" ", $link["link"]);
											$content["link"] .= "<tr valign=\"top\"><td nowrap>".$template_default["article"]["link_sign"]."</td>\n";
											$content["link"] .= "<td><a href=\"".$link["link"]."\"".(($link["target"])?" target=\"".$link["target"]."\"":"").">";
											$content["link"] .= html_specialchars( ($link["name"]) ? $link["name"] : $link["link"] )."</a>";
											$content["link"] .= "</td></tr>\n";
										}
										$content["link"] .= "</table>\n";
							 		}
									
									switch($crow['acontent_position'])
									{ 
										case 1: $content['pos1'] .= $content["link"]; break;
										case 2: $content['pos2'] .= $content["link"]; break;
										case 3: $content['pos3'] .= $content["link"]; break;
										case 4: $content['pos4'] .= $content["link"]; break;
										case 5: $content['pos5'] .= $content["link"]; break;
										default:	$content["main"] .= $content["link"]; break;
									}
									
									break;
									//Link Liste Ende


#
#-----[ FIND ]------------------------------------------
#
									//HTML
						case  6:	$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$content["main"] .= ($crow["acontent_html"]) ? "<br />".$crow["acontent_html"] : "";
									break;
									//HTML Ende

#
#-----[ REPLACE WITH ]------------------------------------------
#

									//HTML
						case  6:	$content["html"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$content["html"] .= ($crow["acontent_html"]) ? "<br />".$crow["acontent_html"] : "";
									
									switch($crow['acontent_position'])
									{ 
										case 1: $content['pos1'] .= $content["html"]; break;
										case 2: $content['pos2'] .= $content["html"]; break;
										case 3: $content['pos3'] .= $content["html"]; break;
										case 4: $content['pos4'] .= $content["html"]; break;
										case 5: $content['pos5'] .= $content["html"]; break;
										default:	$content["main"] .= $content["html"]; break;
									}
									
									break;
									//HTML Ende
									
#
#-----[ FIND ]------------------------------------------
#
									//WYSIWYG HTML
						case 14:	$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$content["main"] .= ($crow["acontent_html"]) ? "<br />".$crow["acontent_html"] : "";
									break;
									//HTML Ende

#
#-----[ REPLACE WITH ]------------------------------------------
#

									//WYSIWYG HTML
						case 14:	$content["wysiwyg"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									$content["wysiwyg"] .= ($crow["acontent_html"]) ? "<br />".$crow["acontent_html"] : "";
									
									switch($crow['acontent_position']) 
									{ 
										case 1: $content['pos1'] .= $content["wysiwyg"]; break;
										case 2: $content['pos2'] .= $content["wysiwyg"]; break;
										case 3: $content['pos3'] .= $content["wysiwyg"]; break;
										case 4: $content['pos4'] .= $content["wysiwyg"]; break;
										case 5: $content['pos5'] .= $content["wysiwyg"]; break;
										default:	$content["main"] .= $content["wysiwyg"]; break;
									}
									
									break;
									//HTML Ende
									
#
#-----[ FIND ]------------------------------------------
#

									//Link Article
						case 8:		$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									if($crow["acontent_alink"]) {
										$alink = explode(":", $crow["acontent_alink"]);
										if(is_array($alink)) {
											$alink_temp = $alink; $alink_sql = "";
											foreach($alink as $key => $value) {
												$alink_sql .= (intval($value)) ? (($alink_sql)?" OR article_id=".intval($value):" article_id=".intval($value)) : "";
											}
										}
										if($alink_sql) {
											$alink_sql = "SELECT article_id, article_title, article_cid FROM ".
														 DB_PREPEND."phpwcms_article WHERE article_public=1 AND ".
														 "article_aktiv=1 AND article_deleted=0 AND (".$alink_sql.");";
											if($result = mysql_query($alink_sql, $db) or die("error while getting link article list: ".$alink_sql)) {
												while($row = mysql_fetch_row($result)) {
													foreach($alink as $key => $value) {
														if(intval($value) == $row[0]) {
															$alink_temp[$key]  = "<tr valign=\"top\"><td nowrap>".$template_default["article"]["link_article_sign"]."</td>\n";
															$alink_temp[$key] .= "<td><a href=\"index.php?id=".$row[2].",".$row[0].",0,0,1,0\" target=\"_self\"";
															$alink_temp[$key] .= get_class_attrib($template_default["article"]["link_article_class"]).">";;
															$alink_temp[$key] .= html_specialchars($row[1])."</a></td></tr>"; //\n
														}
													}
												}
												mysql_free_result($result);
											}
										}
										
										if(count($alink_temp)) {
											$content["main"] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
											$content["main"] .= implode("\n", $alink_temp)."</table>\n";											
										}
									}
									break;
									//Link Article Ende

#
#-----[ REPLACE WITH ]------------------------------------------
#

									//Link Article
						case 8:		$content["artlink"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
									if($crow["acontent_alink"]) {
										$alink = explode(":", $crow["acontent_alink"]);
										if(is_array($alink)) {
											$alink_temp = $alink; $alink_sql = "";
											foreach($alink as $key => $value) {
												$alink_sql .= (intval($value)) ? (($alink_sql)?" OR article_id=".intval($value):" article_id=".intval($value)) : "";
											}
										}
										if($alink_sql) {
											$alink_sql = "SELECT article_id, article_title, article_cid FROM ".
														 DB_PREPEND."phpwcms_article WHERE article_public=1 AND ".
														 "article_aktiv=1 AND article_deleted=0 AND (".$alink_sql.");";
											if($result = mysql_query($alink_sql, $db) or die("error while getting link article list: ".$alink_sql)) {
												while($row = mysql_fetch_row($result)) {
													foreach($alink as $key => $value) {
														if(intval($value) == $row[0]) {
															$alink_temp[$key]  = "<tr valign=\"top\"><td nowrap>".$template_default["article"]["link_article_sign"]."</td>\n";
															$alink_temp[$key] .= "<td><a href=\"index.php?id=".$row[2].",".$row[0].",0,0,1,0\" target=\"_self\"";
															$alink_temp[$key] .= get_class_attrib($template_default["article"]["link_article_class"]).">";;
															$alink_temp[$key] .= html_specialchars($row[1])."</a></td></tr>"; //\n
														}
													}
												}
												mysql_free_result($result);
											}
										}
										
										if(count($alink_temp)) {
											$content["artlink"] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
											$content["artlink"] .= implode("\n", $alink_temp)."</table>\n";											
										}
									}
									
									switch($crow['acontent_position']) 
									{ 
										case 1: $content['pos1'] .= $content["artlink"]; break;
										case 2: $content['pos2'] .= $content["artlink"]; break;
										case 3: $content['pos3'] .= $content["artlink"]; break;
										case 4: $content['pos4'] .= $content["artlink"]; break;
										case 5: $content['pos5'] .= $content["artlink"]; break;
										default:	$content["main"] .= $content["artlink"]; break;
									}
									
									break;
									//Link Article Ende
									
									
#
#-----[ OPEN ]------------------------------------------
#

include/inc_front/content.func.inc.php


#
#-----[ FIND ]------------------------------------------
#

?>


#
#-----[ BEFORE, ADD ]------------------------------------------
#

$content["all"] = str_replace('{FIELD1}', $content["pos1"], $content["all"]);
$content["all"] = str_replace('{FIELD2}', $content["pos2"], $content["all"]);
$content["all"] = str_replace('{FIELD3}', $content["pos3"], $content["all"]);
$content["all"] = str_replace('{FIELD4}', $content["pos4"], $content["all"]);
$content["all"] = str_replace('{FIELD5}', $content["pos5"], $content["all"]);
snobba
Posts: 166
Joined: Sat 6. Mar 2004, 12:41
Location: Sweden
Contact:

Post by snobba »

Thanks for the effort Jerome!

Please post what you have done so far and I will have a look on it and see what I can do...

Good night hacker!

Oh, I see that you posted it above my post - thanks!
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

I would use the function as a way to reduce the number of templates needed that are essentially identical but have minor change such as an image displyed or as has been said before, an article/item that chages often.
I realise thier is no limit to templates you may have but as there is not cut/paste options it get labourious to keep creating templates for everything.

not a moan @ Oliver but an observation born of MY needs & workflow.
good night all
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Getting the same errors w/spirou on newest pwcms

Post by jsw_nz »

Wanted to ask Jerome if he has gotten his hack to work. I think it would be great to see it working on the new version. Will keep a look out........or wait for Oliver's newest release.

cheers, jsw_nz
Post Reply