Freitag, 2. Januar 2009

SMARTY-Zugriff auf Var innerhalb PHP Block


SMARTY - Zugriff auf smarty-Variable im php-Modus

Frage:


{foreach from=$movie item=movie} 


{php}{$movie.id}{/php} 


{/foreach}



das geht ja so nicht.... 



wie kommt ich im {php} {/php} an die smarty var {$movie.id} ?



Antwort:

{php}

$movie =& $this->get_template_vars('movie'); 

echo $movie->id; 

{/php} 

-------------------
  Zuweisung
                                      {foreach name=outer item=module from=$modules.bottom}
                                            {if $module.sort_order==14 && $smarty.session.user_id}
                                                <h5 style="padding-top:12px;">{$module.caption}</h5>
                                                {$module.content}
                                                {php}global $smarty; $smarty->assign('module_14', "active");{/php}
                                            {elseif $module.sort_order==$active && $module_14!="active"}
                                                <h5 style="padding-top:12px;">{$module.caption}</h5>
                                                {$module.content}
                                            {/if}
                                        {/foreach}

-------------------


<pre>{$eventlist|print_r}</pre>
----------------------------------
Zuweisung
{assign var=eventlist value=$xml->veranstaltung}
{$eventlist[1]->datum}

Dienstag, 11. Dezember 2007

TextPad - Regex

Löschen zweier von drei Zeilen


Es soll nur jede dritte Zeile behalten werden:


Suchen und Ersetzen mittels Textpad und der RegEx Option:

Suchpattern: n(^.*$)n^.*$n^.*$
Ersetzen: n1


Anstatt daß explizit Zeilenanfang ^ und Zeilenende $ definiert werden ^.*$ , könnte auch nur .* genommen werden, da ja die n schon Zeilenanfang und -ende darstellen

Siehe auch http://www.tfh-berlin.de/~solymosi/fgi/TextPad.html



Dienstag, 2. Oktober 2007

Videos konvertieren






Videos konvertieren, rippen


http://mediacoder.sourceforge.net/

MP3 zu swf

Konvertierung jeder Menge von Audio und Video Formaten

SUPER von eRightSoft : http://www.chip.de/downloads/SUPER-2008_17370353.html

Ungeschützte DVD rippen:

Windows: DVDx_2_10_setup.exe
Ubuntu: dvd::rip

Das bessere Ergebnis (ohne Interlacing) erzielt Ubuntu.

Videos hosten bei http://sevenload.de (max. 200MB) oder http://video.google.com


Donnerstag, 13. September 2007

rem
rem Backupskript: xcopy "quelle*.*" "ziel" /d /e /c /h /y
rem
SET DRIVE=P

xcopy "C:WindowsFavoriten*.*"
"%DRIVE%:backup_shuttleC
WindowsFavoriten" /d /e /c /h /y

rem EINZELNE EINSTELLUNGEN
xcopy "C:Dokumente und EinstellungenRainerLokale
EinstellungenAnwendungsdatenIdentities{C611C16B-98CE-481A-89B1-1C6615EC58C0}MicrosoftOutlook
Express*.*" "%DRIVE%:backup_shuttleCDokumente und EinstellungenOutlook
Express" /d /e /c /h /y

xcopy "C:Dokumente und EinstellungenRainerEigene Dateien*.*"
"%DRIVE%:backup_shuttleCDokumente und EinstellungenRainerEigene
Dateien" /d /e /c /h /y

xcopy "E:hp*.*" "%DRIVE%:backup_shuttleEhp" /d /e /c /h /y
rem xcopy "E:Tutorials*.*" "%DRIVE%:backup_shuttleETutorials" /d /e /c
/h /y
rem xcopy "E:c++*.*" "%DRIVE%:backup_shuttleEc++" /d /e /c /h /y



backup2.bat

@ECHO off
CLS
REM ----------------------------
REM Name: Sicherung.bat
REM Autor: ***
REM Datum: 28.03.2005
REM ----------------------------
ECHO Beginn, datensicherung von Mozila und Foxmail
ECHO.
xcopy "C:Dokumente und EinstellungenAdministratorAnwendungsdatenMozilla*.*" "D:BackupMozilla%date%*.*" /Y /I /E /s
xcopy "C:ProgrammeFoxmail*.*" "D:BackupFoxmail%date%*.*" /Y /I /E /s
ECHO.
ECHO Ende, datensichung von Mozila und Foxmail
ECHO Beginn, loeschung der Ordner die Aelter als Sieben Tage sind.
ECHO.
for /f "skip=7" %%a in ('dir /b /a:d /o:-d D:BackupMozilla') do rd /s /q D:BackupMozilla%%a
for /f "skip=7" %%a in ('dir /b /a:d /o:-d D:BackupFoxmail') do rd /s /q D:BackupFoxmail%%a
ECHO.
ECHO Ende, loeschung der Ordner die Aelter als Sieben Tage sind.
REM -----------------------------Ende----------------------------



Bei mir wird mit %date% nur das Datum ohne Wochentag (und ohne Leerzeichen) ausgegeben. Damit habe ich dann auch getestet.

Wenn die Ordner z.B. "Mo 28.03.2005" heißen, müssen die Zeilen so aussehen:

for /f "skip=7 delims=" %%a in ('dir /b /a:d /o:-d D:BackupMozilla') do rd /s /q "D:BackupMozilla%%a"
und
for /f "skip=7 delims=" %%a in ('dir /b /a:d /o:-d D:BackupFoxmail') do rd /s /q "D:BackupFoxmail%%a"

Zwei Änderungen
Die delims= Option, damit die gesamte Ausgabezeile des dir Kommandos gelesen wird.
Wichtig: auf keinen Fall ein Leerzeichen zwischen delims= und dem Anführungszeichen setzen. Also so wie oben delims="

Änderung zwei, die Anführungszeichen in der Pfadangabe für das rd Kommando.

Donnerstag, 6. September 2007

Palm Desktop - Google Calendar Sync

syncronisation - Synchronisation - synchronisieren
Angepasst nach http://herold.org/google-calendar-palm-sync.php



Palm <-> Palm Desktop <-> AirSet Desktop Sync <-> www.airset.com <-alle 24h-> calendar.google.com

Kontakte und Kalender zwischen Palm und AirSet, Kalendar zwischen AirSet und Google



Sync your Google Calendar and Palm Device via Airset

    • Airset Google Calendar Sync
  • Select Calendar - Subscribe
    • Airset Google Calendar Sync
  • Click Next
    • Airset Google Calendar Sync
  • To get your Google iCal Address go to Google 'Manage Calendars' and select the calendar you want to import.
    • Google Calendar Sync
  • Click on the iCal icon for your private or public calendar address. Most likely you are using a private address...
    • 0make sure you have your Google iCal Address.
  • Copy the iCal address link to your clipboard
    • 0make sure you have your Google iCal Address.
  • Insert your Google Calendar iCal URL
    • Airset Google Calendar Sync
  • Review the calendar import details and confirm by clicking next.
    • Airset Google Calendar Sync
  • Select the Airset Calendar that you want your Google Calendar to sync with.
    • Airset Google Calendar Sync

Congratulations. Remember Airset Calendars will sync your google calendar every 24 hours. (They indicate that they will create a manual sync button in the future, but in the meantime remember you'll just get a daily update.

You can now sync Airset with your Palm Desktop and Palm Device.

  • Download and Install the Airset Desktop Sync http://www.airset.com/User/Sync.jsp
Install the Application and you'll be sync'n your Google Calendar and Palm Device.

Freitag, 3. August 2007

Ajax Project - Form Entry Suggest

(vgl. http://www.crackajax.net/suggest.php)


ajax.js


var url = "myajaxfunctions.php?param=";

function get_spot_id(idValue)
{

//var idValue = document.getElementById("agtel").value;
var myRandom = parseInt(Math.random()*99999999); // cache buster
http.open("GET", url + escape(idValue) + "&rand=" + myRandom, true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}


function handleHttpResponse()
{
if (http.readyState == 4)
{
document.getElementById("hiddenDIV2").innerHTML=http.responseText;
document.getElementById("hiddenDIV2").style.width="200px";
//alert(document.getElementById("response_table_font").size);
var l = document.getElementById("response_table").rows.length;
document.getElementById("hiddenDIV2").style.height= l*25 +"px";
document.getElementById("hiddenDIV2").style.visibility="visible";
}
}

function loadrecord(record) {
//document.forms[1].telno.value = record;
document.getElementById("agtel").value = record;
document.getElementById("hiddenDIV2").innerHTML='';
document.getElementById("hiddenDIV2").style.height="0px";
document.getElementById("hiddenDIV2").style.width="0px";
document.getElementById("hiddenDIV2").style.visibility="hidden";
}

myajaxfunctions.php

if(strlen($_REQUEST['param'])>0)
{
/*$result = mysql_query("SELECT * FROM contact WHERE ContactTel LIKE '$_REQUEST['param']%'");
if(mysql_num_rows($result)>0)
{
while($myrow = mysql_fetch_array($result))
{
$agenttel = $myrow["ContactTel"];
$agentid = $myrow["ContactID"];
$textout .= "<table><tr style="border: 0px solid black"> <td style="border: 0px solid black; padding: 0px 10px 0px 10px"> <a href="javascript:loadrecord('".$agenttel."')">" .$agentid."</a></td> <td style="border: 0px solid black; padding: 0px 10px 0px 10px">" .$agenttel."</td></tr></table>";
}
}
else { $textout=""; }
*/

$textout .= "<table width='50px'>";
$textout .= "<tr style="border: 0px solid black"> <td style="border: 0px solid black; padding: 0px 10px 0px 10px"> <a href="javascript:loadrecord('112')">112</a></td> <td style="border: 0px solid black; padding: 0px 10px 0px 10px">Tom</td></tr>";
$textout .= "<tr style="border: 0px solid black"> <td style="border: 0px solid black; padding: 0px 10px 0px 10px"> <a href="javascript:loadrecord('100111')">100111</a></td> <td style="border: 0px solid black; padding: 0px 10px 0px 10px">Rainer</td></tr>";
$textout .= "</table>";

$textout='';
$textout .= "<font id='response_table_font' size='2'>";
$textout .= "<table id='response_table'>";
$textout .= "<tr > <td > <a href="javascript:loadrecord('112')">112</a></td> <td >Tom</td></tr>";
$textout .= "<tr > <td > <a href="javascript:loadrecord('112')">112</a></td> <td >Tom</td></tr>";
$textout .= "<tr > <td > <a href="javascript:loadrecord('112')">112</a></td> <td >Tom</td></tr>";
$textout .= "<tr > <td > <a href="javascript:loadrecord('112')">112</a></td> <td >Tom</td></tr>";
$textout .= "<tr > <td > <a href="javascript:loadrecord('112')">112</a></td> <td >Tom</td></tr>";
$textout .= "</table></font>";

}
echo $textout;


page.html


Wo?<br />
<input id="agtel" type="text" name="telno" onKeyUp="javascript:if(this.value.length > 3) get_spot_id(this.value);">

<div id="hiddenDIV2" name="hiddenDIV2" style="position:relative; top: 2px; left: 2px;width: 200px; visibility:hidden; background-color:white; border: 1px solid black;"> </div>



Editieren mit Browser - edit.php

<?php


$_REQUEST['dateiname'] =='' ? $file = "./index.php" : $file = $_REQUEST['dateiname'];


if(isset($_GET['action']) AND $_GET['action'] == 'update' AND $_POST['update_txt']!='') {
$fp = fopen($file, "w");
if(fwrite($fp, stripcslashes($_POST['update_txt']))) {
echo "Update erfolgreich.";
} else {
echo "Fehler beim Update.";
}
}
// else {
$content = file_get_contents($file);
echo '<form action="'.$_SERVER['PHP_SELF'].'?action=update&file='.$file.'" method="post" >';
echo 'Zu öffnende Datei: <input name="dateiname" type="text" size="50" maxlength="50" value="'.$file.'"><br>';
echo '<textarea name="update_txt" cols="70" rows="30" >'.$content.'</textarea><br/>';
if($file==''){ echo '<input type="submit" value="Datei laden" /></form>';}

else{ echo '<input type="submit" value="Update" /></form>';}
//}

function listdir($start_dir='.') {

$files = array();
if (is_dir($start_dir))
{
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false)
{
# loop through the files, skipping . and .., and recursing if necessary
if (strcmp($file, '.')==0 || strcmp($file, '..')==0) continue;
$start_dir == "." ? $filepath = $file : $filepath = $start_dir ."/". $file;
if ( is_dir($filepath) )
$files = array_merge($files, listdir($filepath));
else
array_push($files, $filepath);
}
closedir($fh);
}
else
{
# false if the function was called with an invalid non-directory argument
$files = false;
}

return $files;

}

echo "Vorhanden sind folgende Dateien:<br>";
$files = listdir();
foreach($files as $f)
echo " <a href='./edit.php?dateiname=".addslashes($f)."' >".$f."</a>,";
?>