WCMSBlog v0.6 (was Phpwcms Blog Module)

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
munzli
Posts: 20
Joined: Wed 25. Oct 2006, 19:04
Location: Zürich, Switzerland
Contact:

Post by munzli »

also auf http://mg888.freeprojekt.de/ sind die permissions falsch auf das blog.module file.

bei http://mg888.mg.ohost.de/ muss das css angepasst werden da jetzt keine tables sondern divs verwendet werden. um den slide effect bei den kommentaren wieder zum laufen zu bringen muss wie gesagt im include/inc_front/content.article.inc.php ca. auf zeile 51-53:

Code: Select all

initializeLightbox();
einfügen
nehemia
Posts: 118
Joined: Mon 11. Sep 2006, 21:19
Location: Fürth
Contact:

Post by nehemia »

Also, ich konzentriere mich jetzt zunächst mal auf phpwcms 1.3.5pre, also http://mg888.ohost.de:

- In der Datei include/inc_front/content.article.inc.php ca. auf Zeile 51 habe ich, wie Du gesagt hast, den

Code: Select all

initializeLightbox();
eingefügt. Die Folge ist, dass der Ziehharmonikaeffekt tatsächlich wieder funktioniert. Sehr gut. ':)'

- Als nächstes habe ich den gesamten Inhalt der Datei blog.style.css in die Datei frontend.css eingefügt. Die Folge ist, dass im Blog wieder graublau-farbige Titelkästchen zu sehen sind und auch der Titel und Untertitel im Verhältnis zueinander richtig dargestellt werden. ':)'
Was nicht richtig dargestellt wird, ist - soweit ich das sehen kann:
- bei den Kommentaren der Hintergrund und die unterschiedliche Farbe der Kommentatoren
- Die Datumsanzeige der einzelnen Blogs (mittige statt rechter Ausrichtung!). Interessant ist, dass beim Aufruf der Kommentare die Ausrichtung nach rechts geht, und bei einem nochmaligen Klick auf die Kommentare, die Ausrichtung wieder mittig ist.

Ich verstehe nicht, warum diese Einstellungen nicht auch durch das Kopieren des Inhalts der Datei blog.style.css in die Datei frontend.css übernommen werden? Und wo kann ich das in der frontend.css dann ändern und was muss ich letztlich noch ändern, damit der Blog dann wieder so aussieht, wie vorher?

Gruß, Martin
munzli
Posts: 20
Joined: Wed 25. Oct 2006, 19:04
Location: Zürich, Switzerland
Contact:

Post by munzli »

wie gesagt hab ich ein paar änderungen gemacht... musst halt selbst das css bearbeiten... firebug ist ein geniales add-on für das!

hier kannst du sonst mein teil des css das ich geschrieben habe mal anschauen:

Code: Select all

.blogcommentheader, 
.blogcontent, 
.blogcomments, 
.blogheader
{
	clear: both;
	display: block;
}

.blogtext
{
	float: left;
	width: 510px;
	padding: 10px;
	margin-bottom: 10px;
}

.blogcontent a, 
.blogcontent a:visited, 
.blogcontent a:link
{
	color: #000;
	background-color: #fff;
	text-decoration: none;
}
.blogcontent a:hover,
.blogcontent a:focus,
.blogcontent a:active
{
	color: #fff;
	background-color: #000;
}


.blogdate
{
	float: right;
	color: #666;
	font-size: 6pt;
}

.blogheadline
{
	background-color: #000;
	display: inline;
	font-size: 10pt;
	color: #fff;
	font-weight: bold;
	padding: 2pt;
}

.blogcomments .right
{
	float: right;
}

.blogheader
{
	margin-bottom: 10px;
}

.addblogcomment input, 
.addblogcomment textarea
{
	width: 350px;
	border: solid 1px #333;
	background-color: #ddd;
}

.gbInputFieldCaptcha
{
	width: 50px !important;
	margin: 6px 0px 11px 0px;
}

.addblogcomment label
{
	display: block;
}

.addblogcomment p
{

}

.addblogcomment, 
.comments
{
	margin-top: 7px;
	padding: 0px 0px 7px 0px;
	border-top: dashed 1px #000;
}

.blogcomments a, 
.blogcomments a:visited, 
.blogcomments a:link
{
	color: #353535;
	background-color: none;
	text-decoration: none;
}
.blogcomments a:hover,
.blogcomments a:active,
.blogcomments a:focus
{
	text-decoration: underline;
die seite werde ich posten sobald ich fertig bin ;)



der effekt kannst du noch bearbeiten im blog.modul.php

duration: 1000, transition: Fx.Transitions.Expo.easeOut
ist jetzt eingestellt.... du kannst auf der mootools seite mal schauen und z.B.
duration: 1500, transition: Fx.Transitions.Elastic.easeOut
einfügen
nehemia
Posts: 118
Joined: Mon 11. Sep 2006, 21:19
Location: Fürth
Contact:

Post by nehemia »

Hallo munzli,
vielen Dank für Deine css-Einstellungen. Natürlich will ich selber herausfinden, wie's geht. Aber wenn man überhaupt keine Ahnung hat, ist man schon dankbar für heiße Tips... ;-)
Also heute habe ich den ganzen Tag in der frontend.css herumgebastelt. Ausgangspunkt waren Deine Einstellungen. Und schau mal hier, das ist dabei herausgekommen:
http://mg888.ohost.de
Ich bin ganz schön stolz, dass ich das so hingekriegt habe! Na ja, drei Fragen habe ich noch an Dich:
1. Wie und wo kann ich deutsche Wochentage im Weblogdatum einstellen?
2. Wie und wo kann ich einstellen, dass der Kommentar-Author andersfarbig dargestellt wird, beispielsweise in rot?
3.
der effekt kannst du noch bearbeiten im blog.modul.php

duration: 1000, transition: Fx.Transitions.Expo.easeOut
ist jetzt eingestellt.... du kannst auf der mootools seite mal schauen und z.B.
duration: 1500, transition: Fx.Transitions.Elastic.easeOut
einfügen
Wozu brauch ich jetzt noch diese Einstellungen?
Vielen Dank für Deine Geduld und großartige Hilfe.
Gruß, Martin
iChiel
Posts: 6
Joined: Fri 6. Jul 2007, 16:41

Post by iChiel »

Hello Munzli,

I also got the BLOG working in version 1.3.3.
To get the flying effect I copied the moo.fx from 1.3.5pre to 1.3.3 after that i had no problems with it, but before it didn't work.

You can see a demo on http://www.michielblok.nl/

The only thing I can't get to work is the blogrss.php. It says that the database user has no acces rights because it's not using a pasword?

Do you know how i can fix this?
munzli
Posts: 20
Joined: Wed 25. Oct 2006, 19:04
Location: Zürich, Switzerland
Contact:

Post by munzli »

nehemia wrote: 1. Wie und wo kann ich deutsche Wochentage im Weblogdatum einstellen?
also jetzt wird das datum mit strftime angezeigt und zwar mit der formatierung: %a %d/%m/%y %H:%M
auf der php seite (link oben) siehst du was die parameter sind.
Weil der locale nicht gesetzt ist kannst du oben im blog.module.php einfach noch:

Code: Select all

setlocale(LC_ALL, 'de_DE');
eintragen, dann sollte es auf deutsch sein.
nehemia wrote: 2. Wie und wo kann ich einstellen, dass der Kommentar-Author andersfarbig dargestellt wird, beispielsweise in rot?
hmmm sieht aus als hätte ich den author nicht in ein eigenes element getan... oops.

ändere das blog.module.php so das ca. bei zeilen 155-170 (muss halt selber nachschauen wies bei dir ist) der inhalt so ist:

Code: Select all

$s .= "<div class='blogcomments'>";

				while ($comment = mysql_fetch_array($cres))

				{

					$s .= "<div class='blogcommentheader'><b>";

					if ($comment ["url"] != "http://" && $comment["url"] != "") {
						$s .= "<a href='" . $comment["url"] . "'>";
					}

					$s .= $comment["author"];

			 		if ($comment ["url"] != "") {
						$s .= "</a>";
					}

					$s .= ":</b></div><br />";

					$s .= nl2br(trim($comment["comment"]));

					$s .= "<div style='height: 1px; border-top: 1px dashed #000; width: 100%; padding: 0; margin: 6px 0 6px 0;'></div>";

				}

				$s .= "</div>";
wie gesagt, das file ist immernoch ein chaos, ich habs nur XHTML tauglich gemacht.

wenn das stimmt solltest du die farbe mit der class "blogcommentheader" einfärben können.
nehemia wrote: 3. Wozu brauch ich jetzt noch diese Einstellungen?
das brauchst du eigentlich nicht... ist nur um den aufklapp effekt zu ändern ;)



iChiel wrote: The only thing I can't get to work is the blogrss.php. It says that the database user has no acces rights because it's not using a pasword?

Do you know how i can fix this?
somehow my blogrss.php doesn't show anything, but i'll get it to work and post about it.

like i posted earlier (probably in german) you don't need moo.fx anymore if you use my version of blog.module.php because i changed it to mootools (which is what phpwcms uses for lightbox) and also added the captcha.
nehemia
Posts: 118
Joined: Mon 11. Sep 2006, 21:19
Location: Fürth
Contact:

Post by nehemia »

Vielen Dank munzli für Deine ausführliche Erläuterung. Ich werde sie nacheinander Schrittt für Schritt durchgehen.

Was die deutsche Ausgabe der Wochentage angeht, bin ich tatsächlich etwas ratlos, da ich bereits vor Deiner Antwort mit der Einstellung

setlocale();

rumprobiert habe und auch heute wieder. Leider bisher ohne Erfolg.
Mein Code sieht momentan hier so aus:

Code: Select all

			$s .= setlocale(LC_ALL, "de_DE");
			$s .= "<span class='blogdate'>"  . strftime("%A, %d.%m.%y %H:%M", $e["time"]) . " Uhr</span> " ;
Das Datum wird auch korrekt ausgegeben, bis eben auf den Wochentag.
Vielleicht fällt Dir oder auch anderen Lesern ja noch was ein dazu.
Gruß, Martin
iChiel
Posts: 6
Joined: Fri 6. Jul 2007, 16:41

Post by iChiel »

Hallo,

Ich schreibe in English weil das für mir einfacher ist.. Wann du es nicht verstehen kan, lass es wissen und soll ich probieren Deutsch zu schreiben..

strftime has to be in the top of you document and not in the $s variable..

I put mine on the first line of blog.module.php (after <?PHP) and then it works.

I hope you can work with this.
iChiel
Posts: 6
Joined: Fri 6. Jul 2007, 16:41

Post by iChiel »

Hello Martin,

as you requested, will i post my blog.module.php.
It's almost original, i only added the time thing on the first line.

:)

Code: Select all

<?php
setlocale (LC_TIME, "nl_NL"); 

include("include/inc_module/mod_blogs/inc_lib/functions.general.inc.php");

include("include/inc_module/mod_blogs/inc_lib/functions.db.inc.php");



function bm_render_blog($title)

{
   global $gt, $b_prefs;
   $s = '';
   
   // style element not allowed here, this is XHTML baby!   
   //$s .= file_get_contents((dirname(realpath(__FILE__)) . "/blog.style.css"));

   /* removed the next lines since i'm now using mootools
    *
    * you need to call initializeLightbox(); in a frontend rendering file like: content.article.inc.php
    * just add it somewhere so it's called on that page that you want to have the news.
    */

   //$s .= '<script src="scripts/prototype.lite.js" type="text/javascript"></script>

     //<script src="scripts/moo.fx.js" type="text/javascript"></script>';


   // Number of blog entries per page

   $pp = 5;



   if ($_GET["offset"] != "") $start = $_GET["offset"];

   else $start = 0;

   



     $bid = db_get_blogid($title);

   unserialize_prefs($bid);



   // Add a comment if we've been sent one

   if ($_POST["addcomment"] == true && $_POST["comment"] != "" && !empty($_POST["captcha"]))

   {
      include_once (PHPWCMS_ROOT.'/include/inc_ext/SOLMETRA_FormValidator/SPAF_FormValidator.class.php');


      // instantiate the object

      $spaf_obj = new SPAF_FormValidator();

      $captcha = clean_slweg($_POST['captcha']);

      if ($spaf_obj->validRequest($captcha)) {

         // destroy successful code

         $spaf_obj->destroy();
         
         $success = db_add_comment($_POST["entryid"], $_POST["author"], $_POST["url"], $_POST["comment"]);


         $msg = file_get_contents(dirname(__FILE__) . "/email.txt");      

         $search = array("*COMMENT*", "*AUTHOR*", "*PERMALINK*", "*SITE*", "*TITLE*");

         $replace = array($_POST["comment"], $_POST["author"], $phpwcms["site"] . $b_prefs["permalink"], $phpwcms["site"], $title);

         $msg = str_replace($search, $replace, $msg);

         send_comment_notification($b_prefs["commentemails"], $msg);

      } else {

         $s .= '<div class="captcha_error">Fill in the correct security code!</div>';

      }



   }


   if ($bid != "")

   {

      if ($_GET["permalink"] != "")

      {

         $entries = db_get_permalink_entry($_GET["permalink"]);

      }

      else

      {

         $entries = db_get_entries($bid, $start, $pp);

      }


      foreach($entries as $e)

      {


         $s .= "<div class='blogtext'>";

         $cres = db_get_comments($e["id"]);

         $ccount = mysql_num_rows($cres);

         $etext = $e["content"];

         $eid = $e["id"];

         $etext = nl2br($etext);


         $s .= "<div class='blogheader'>";

         $s .= "<span class='blogdate'>" . strftime("%a %d/%m/%y %H:%M", $e["time"]) . "</span>";

         $s .= "<div class='blogheadline'>" . $e["title"] . "</div></div>";

         $s .= "<div class='blogcontent'><div class='blogsubtitle'>" . $e["subtitle"] . "</div>" . $etext . "</div>";



         // Begin comments

         $s .= "<div class='blogcomments'><div class=\"right\">";



         if ($ccount > 0) {
            $s .= "<a style='cursor:pointer;' onclick='c" . $bid . "_" . $eid . ".toggle()'><b>";
         }

         $s .= "$ccount reactie";

         
         if ($ccount != 1) {
            $s .= "s";  // "Comment" or "Comments"?
         }

         
         if ($ccount > 0) {
            $s .= "</b></a>";
         }

         
         // create a correct URL so it's XHTML valid
        // $request_uri = preg_replace('/?/','?',$_SERVER['REQUEST_URI']);


         if (!$_GET["permalink"]) {

            ($_SERVER["QUERY_STRING"] != "") ? $permalink = $request_uri . "?" : $permalink = $request_uri;

         
            // remove offset parameter for permalink
            //$permalink = preg_replace("/&offset=\d*/i", "", $permalink);
            // permalink parameter

            $permalink .= "?permalink=$eid";

         }

         $s.= "<span style='color: #999'> | </span> <a id='link$bid-$eid' style='cursor:pointer;' onmousedown='ac" . $bid . "_" . $eid . ".toggle()'>Reageer</a></div>";

         $s.= "<a href='" . $permalink . "'>permalink</a>";
            $s .= "</div>";

         $s .= "<div style='width:100%' id='el" . $bid. "addcomment" . $eid . "'>";

         $s .= "<form method='post' action='" . $request_uri . "'>

               <input type='hidden' name='entryid' value='$eid'/>

               <input type='hidden' name='addcomment' value='true'/>

               <div style='width: 100%' class='addblogcomment'>

                  <p>

                     <label for='author" . $bid . "_" . $eid . "'>Naam:</label>

                     <input id='author" . $bid . "_" . $eid . "' name='author' type='text' />
                  </p>                  
                  <p>

                     <label for='url" . $bid . "_" . $eid . "'>Website:</label>

                     <input id='url" . $bid . "_" . $eid . "' name='url' type='text' />

                  </p>                  
                  <p>

                     <label for='comment" . $bid . "_" . $eid . "'>Reactie:</label>

                     <textarea id='comment" . $bid . "_" . $eid . "' name='comment' rows='5' cols='43'></textarea>
                  </p>                  
                  <!--CAPTCHA_START//-->   

                  <p>

                     <label for='captcha" . $bid . "_" . $eid . "'>Code:</label>

                     <input name='captcha' type='text' id='captcha" . $bid . "_" . $eid . "' class='gbInputFieldCaptcha' value='' size='10' maxlength='10' />

                     <img src='img/captcha.php?regen=y&length=5&".time()."' alt='captcha' border='0' class='gbCaptchaImage' />

                  </p>

                  <!--CAPTCHA_END//-->
                  <p>

                     <input class='submit' type='submit' value='Voeg reactie toe!'/>
                  </p>
               </div>

            </form>";

         $s .= "</div>";

         

         $s .= "<div style='width: 100%' class='comments' id='el" . $bid. "comments" . $eid . "' >";


         if ($ccount > 0)

         {

            $s .= "<div class='blogcomments'>

                  <div class='blogcommentheader'>";

            while ($comment = mysql_fetch_array($cres))

            {

               $s .= "<b>";

               if ($comment ["url"] != "http://" && $comment["url"] != "") {
                  $s .= "<a href='" . $comment["url"] . "'>";
               }

               $s .= $comment["author"];

                if ($comment ["url"] != "http://" && $comment["url"] != "") {
                  $s .= "</a>";
               }

               $s .= ":</b><br />";

               $s .= nl2br(trim($comment["comment"]));

               $s .= "<div style='height: 1px; border-top: 1px dashed #000; width: 100%; padding: 0; margin: 6px 0 6px 0;'></div>";

            }

            $s .= "</div></div>";

         }


         $s .= "</div>";

         $s .= "<script type='text/javascript'>

                  var ac" . $bid . "_" . $eid . " = new Fx.Slide('el" . $bid . "addcomment" . $eid . "', {duration: 1000, transition: Fx.Transitions.Expo.easeOut});

                  c" . $bid . "_" . $eid . " = new Fx.Slide('el" . $bid . "comments" . $eid . "', {duration: 1000, transition: Fx.Transitions.Expo.easeOut});
                  ac" . $bid . "_" . $eid . ".hide();

                  c" . $bid . "_" . $eid . ".hide();

               </script>";

         $s .= "</div>";

      }

      if ($_GET["permalink"] == "")

      {

         $prevlink = $request_uri;

         $nextlink = $request_uri;



         $prevlink = preg_replace("/&offset=\d*/i", "", $prevlink);

         $nextlink = preg_replace("/&offset=\d*/i", "", $nextlink);



         if (strstr($prevlink, "?") !== false)

         {

              $prevlink .= "&";

            $nextlink .= "&";

         }

         else

         {

              $prevlink .= "?";

                $nextlink .= "?";

         }



         $prevlink .= "offset=" . ($_GET["offset"] + $pp);

         $nextlink .= "offset=" . ($_GET["offset"] - $pp);



         if ($start >= $pp) {
            $s .= "<span style='float:right'><a href='$nextlink'>NEXT >></a></span>";
         }

         if (db_num_entries($bid)-($start + $pp) > 0) {
            $s .= "<a href='$prevlink'><< PREVIOUS</a>";
         }

      }

   }
   // removed this since i don't need the permalink to be displayed with the GT mod

   /*if(class_exists('get_gt_by_style')) {

      $s = preg_replace('/\{GT:(.+?)\}(.*?)\{\/GT\}/ei', "get_gt_by_style(\$gt, \"\$1\", \"\$2\")", $s);
   }*/
  return $s;

}





if(!empty($content["all"]) && !(strpos($content["all"],'{BLOG')===false))

{

   // Style

   $content["all"] = preg_replace('/\{BLOG:(.+?)\}/ei', "bm_render_blog(\"$1\")", $content["all"]);

}

?>
nehemia
Posts: 118
Joined: Mon 11. Sep 2006, 21:19
Location: Fürth
Contact:

Post by nehemia »

Thanks Michiel,
i did it now the same way you proposed and put the setlocale() just at the beginning of the site, right after <?php:

Code: Select all

<?php
setlocale (LC_ALL, 'de_DE'); 
... 

and then further below in the Code

Code: Select all

... 
$s .= "<span class='blogdate'>"  . strftime("%A, %d.%m.%y %H:%M", $e["time"]) . " Uhr</span> " ; 
... 
But once again, the weekday is displayed in English and not in German then. Apparently there seems to be a barrier somehow, so that it isn't possible to set it. But where and why ...?! ':cry:'
Greetings,
Martin
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Post by juergen »

hallo nehemia

da musst ein kleines script drüberhängen, Wochentage gibts nur in english ;)
munzli
Posts: 20
Joined: Wed 25. Oct 2006, 19:04
Location: Zürich, Switzerland
Contact:

Post by munzli »

DF6IH wrote:hallo nehemia

da musst ein kleines script drüberhängen, Wochentage gibts nur in english ;)
zumindest kennt dein server das locale de_DE nicht, aber das kann unterschiedlich sein :(
es gibt jedoch verschiedene, also probier mal das und gib einfach alle an:

Code: Select all

setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'deu_deu', 'german');
eines von denen sollte doch gehen ;)
nehemia
Posts: 118
Joined: Mon 11. Sep 2006, 21:19
Location: Fürth
Contact:

Post by nehemia »

@munzli: Genauso

Code: Select all

setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'deu_deu', 'german');
hab ich jetzt die setlocale eingebaut. Leider nach wie vor ohne Erfolg! :(

@DF6IH:
da musst ein kleines script drüberhängen, Wochentage gibts nur in english
Was für ein script meinst Du denn? Hat jemand sowas schon mal geschrieben und wo krieg ich das dann her? :?
Gruß,
Martin
munzli
Posts: 20
Joined: Wed 25. Oct 2006, 19:04
Location: Zürich, Switzerland
Contact:

Post by munzli »

nehemia wrote:@munzli: Genauso

Code: Select all

setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge', 'deu_deu', 'german');
hab ich jetzt die setlocale eingebaut. Leider nach wie vor ohne Erfolg! :(
hmm habs bei mir probiert und hat funktioniert.
nehemia wrote: @DF6IH:
da musst ein kleines script drüberhängen, Wochentage gibts nur in english
Was für ein script meinst Du denn? Hat jemand sowas schon mal geschrieben und wo krieg ich das dann her? :?
Gruß,
Martin
werde dir später ein beispiel schicken...
munzli
Posts: 20
Joined: Wed 25. Oct 2006, 19:04
Location: Zürich, Switzerland
Contact:

Post by munzli »

sorry hab zur zeit viel zu tun...

aber eins nimmt mich trotzdem wunder, was ist der output wenn du das

Code: Select all

<?php
print_r(system('locale -a'));
?>
in eine datei schmeisst und dann ausführst per webbrowser? kannst du posten was steht?
Post Reply