Zurück tutorials.de > Programming > PHP

 
 
Hallo und herzlich willkommen! Tutorials.de ist eine Hilfe-Community mit dem Motto User helfen Usern. Als Gast verfügst Du über Schreibrechte in unseren Foren und Blogs. Du kannst dich aber gerne auch kostenlos registrieren und Teil unserer Gemeinschaft werden! Viel Spaß & Erfolg bei der Vermehrung deines Wissens :-)

Themen: 242.975 | Beiträge: 1.352.293 | Mitglieder: 169.418 (Stand 28.01.10) | Fragen zur Nutzung von Tutorials.de? Nutzungsregeln | Kontaktformular | Impressum

Jubiläums-Countdown 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09


4 kostenlose Bücher bei unserer Buch-Verschenkaktion 03/2010
  AntwortAntworten (über Gastzugang)    
  AntwortAntworten (über Gastzugang)    
 
Themen-Optionen Ansicht
Alt 10.07.06, 12:17   #1 (permalink)
Mitglied
 
Registriert seit: May 2006
Beiträge: 17
Renommee-Modifikator: 0
digifoho hat eine blütenweiße Weste

wichtige Ankündigung/Information gallery / modul problem....

hallo...

also ich hab da ein kleines/großes Problem...

Hab mir für das Opensorce-Script "gallery" das Modul "cart" runtergeladen und versuch dies zu erweitern.
Das Modul "cart" kann folgendes: Die Bilder von der Gallery in einen Warenkorb legen...
so und folgende Erweiterung versuch ich einfügen:

Das man die Bilder bestellen kann und zwar in unterschiedlichen Grössen.
Das heisst ich bau ein Formular dazu das mir die Name, Adresse etc. - Bildnummer und die gewünschte Größe per e-mail übermittelt. Nur ist das Modul mit tpl Datein aufgebaut...und ich komm da nicht zurecht.

link: Ihren Warenkorb anzeigen es sind auch zwei Bilder online zum testen

Kennt das Modul jemand und kann mir da jemand Rat geben?



das ist die Datei viewcart.tpl:
PHP-Code:
{*
 * 
$Revision1.39 $
 * If 
you want to customize this file, do not edit it directly since future upgrades
 
may overwrite it.  Insteadcopy it into a new directory called "local" and edit that
 
version.  Gallery will look for that file first and use it if it exists.
 *}

<
div class="gbBlock gcBackground1">
  <
h2> {g->text text="Items Currently in Your Cart"} </h2>
</
div>

{if !empty(
$ViewCart.items)}
<
form action="{g->url}" method="post">
  <
div>
    {
g->hiddenFormVars}
    <
input type="hidden" name="{g->formVar var="controller"}" value="{$ViewCart.controller}"/>
    <
input type="hidden" name="{g->formVar var="form[formName]"}" value="{$form.formName}"/>
  </
div>
  <
div class="gbBlock gcBackground2" style="text-align: right; white-space: nowrap">
    <
select name="{g->formVar var="form[pluginId]"}">
      <
option label="{g->text text="&laquocart actions &raquo;"}"
       
value="" selected="selected">{g->text text="&laquo; cart actions &raquo;"}</option>
      <
option label="{g->text text="Empty Cart"}"
       
value="emptyCart"> {g->text text="Empty Cart"} </option>

      {foreach 
from=$ViewCart.plugins key=pluginId item=pluginData}
      <
option label="{$pluginData.actionDisplayName}"
       
value="{$pluginId}"> {$pluginData.actionDisplayName} </option>
      {/foreach}
    </
select>
    <
input type="submit" class="inputTypeSubmit"
     
name="{g->formVar var="form[action][modify]"}" value="{g->text text="Go"}"/>
  </
div>
{/if}
</
form>
{if isset(
$status.cartModified)}
<
div class="gbBlock"><h2 class="giSuccess">
  {
g->text text="Cart updated successfully"}
</
h2></div>
{/if}

<
form action="main.php?g2_view=cart.ViewCart&send=ok" method="POST">

{if empty(
$ViewCart.items)}
<
div class="gbBlock"><strong>
  <
p> {g->text text="Your cart is empty."} </p>
  <
p>
    {
g->text text="To add items, browse the gallery and select 'Add to cart' from the item's action menu."}
  </
p>
  </
strong>
</
div>
{else}

<
div class="gbBlock">
  <
table class="gbDataTable" width="400px"><tr>
    <
th colspan="2" align="center"> {g->text text="Item"} </th>
    <
thFormate Anzahl </th>
  </
tr>
  {foreach 
from=$ViewCart.items item=item}
  <
tr class="{cycle values="gbEven,gbOdd"}">
    <
td>
      <
center><a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$item.id`"}">
        {if isset(
$ViewCart.thumbnails[$item.id])}
      {
g->image item=$ViewCart.items[$item.idimage=$ViewCart.thumbnails[$item.id]
            
maxSize=90}
        {else}
      {
g->text text="No thumbnail"}
        {/if}
      </
a></center>
    </
td><td>
      <
ul>
        <
li>
      <
strong>{g->text text="Title:"}</strong>
    {
$item.title|markup}
        </
li>
      </
ul>
    </
td><td align="center">
    
      
10x15: <input type="text" value="0" name="10x15_{$item.title|markup}" size="2" /><br>
      
13x18: <input type="text" value="0" name="13x18_{$item.title|markup}" size="2" /><br>
      
15x21: <input type="text" value="0" name="15x21_{$item.title|markup}" size="2" /><br>
      
20x30: <input type="text" value="0" name="20x30_{$item.title|markup}" size="2" /><br>
    </
td>
  </
tr>
  {/foreach}
{/if}
<
tr><td></td><td></td><td><br> <center><input type="submit" value="--> next -->" /></center> </td></tr>
  </
table>
</
div>
<
br><br>
</
form

und das die viewcart.inc

PHP-Code:
<?php
/*
 * $RCSfile: ViewCart.inc,v $
 *
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2006 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
 */
/**
 * @version $Revision: 1.19 $ $Date: 2006/01/10 04:38:59 $
 * @package Cart
 * @subpackage UserInterface
 * @author Bharat Mediratta <bharat@menalto.com>
 */

/**
 * Required classes
 */
GalleryCoreApi::requireOnce('modules/cart/classes/CartHelper.class');

/**
 * This view will allow users to view their individual carts
 *
 * @package Comment
 * @subpackage UserInterface
 */
 
class ViewCartView extends GalleryView {


    
/**
     * @see GalleryView::loadTemplate
     */
    
function loadTemplate(&$template, &$form) {
    global 
$gallery;

    list (
$ret$itemList) = CartHelper::loadCartItems();
    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }
    list (
$ret$cartItemIds) = CartHelper::fetchCartItemCounts();
    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }

    if (
$form['formName'] != 'ViewCart') {
        
/* First time around, initialize the cart counts */
        
foreach ($cartItemIds as $itemId => $count) {
        
$form['counts'][$itemId] = $count;
        }
        
$form['formName'] = 'ViewCart';
    }
    
$ViewCart = array();

    
/* Bring in the root album information for the breadcrumb */
    
list ($ret$rootAlbumId) =
        
GalleryCoreApi::getPluginParameter('module''core''id.rootAlbum');
    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }
    list (
$ret$rootAlbum) = GalleryCoreApi::loadEntitiesById($rootAlbumId);
    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }
    
$ViewCart['rootAlbum'] = (array)$rootAlbum;

    
/* Find all our cart plugins */
    
GalleryCoreApi::requireOnce('modules/cart/classes/CartPluginInterface_1_0.class');
    list (
$ret$ids) =
        
GalleryCoreApi::getAllFactoryImplementationIds('CartPluginInterface_1_0');
    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }
    
$plugins = array();
    foreach (
$ids as $id => $className) {
        list (
$ret$instances[$id]) =
        
GalleryCoreApi::newFactoryInstance('CartPluginInterface_1_0'$className);
        if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
        }

        
/*
         * Figure out what types each plugin can handle so that we can cue the UI
         * to only send it the ones of the appropriate types.
         */
        
$plugins[$id]['supportedItemTypes'] = $instances[$id]->getSupportedItemTypes();
        list (
$ret$plugins[$id]['actionDisplayName']) =
        
$instances[$id]->getActionDisplayName();
        if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
        }
    }

    
$items = array();
    
$thumbnails = array();
    
$itemTypeNames = array();
    if (!empty(
$cartItemIds)) {
        foreach (
$itemList as $item) {
        
$items[$item->getId()] = (array)$item;

        
/* TODO: This is a O(N^3) operation -- probably should be optimized */
        
foreach ($plugins as $pluginId => $pluginData) {
            foreach (
$pluginData['supportedItemTypes'] as $type) {
            if (
$type == '*') {
                
$plugins[$id]['supported'][$item->getId()] = 1;
                break;
            } else {
                if (
GalleryUtilities::isA($item$type)) {
                
$plugins[$id]['supported'][$item->getId()] = 1;
                break;
                }
            }
            }
        }

        
$itemTypeNames[$item->getId()] = $item->itemTypeName();
        }

        
/* Fetch thumbnails */
        
list ($ret$thumbnailList) =
        
GalleryCoreApi::fetchThumbnailsByItemIds(array_keys($cartItemIds));
        if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
        }
        foreach (
$thumbnailList as $thumbnail) {
        
$thumbnails[$thumbnail->getParentId()] = (array)$thumbnail;
        }
    }

    
$ViewCart['items'] = $items;
    
$ViewCart['itemTypeNames'] = $itemTypeNames;
    
$ViewCart['thumbnails'] = $thumbnails;
    
$ViewCart['plugins'] = $plugins;
    
$ViewCart['controller'] = 'cart.ModifyCart';
    
$template->setVariable('ViewCart'$ViewCart);



    
$urlGenerator =& $gallery->getUrlGenerator();
    list (
$ret$navigationLinks) = $urlGenerator->getNavigationLinks();
    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
 }
    
$template->setVariable('navigationLinks'$navigationLinks);

    list (
$ret$module) = GalleryCoreApi::loadPlugin('module''cart');

    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }

    
$template->title($module->translate('View Your Cart'));
    return array(
null,
             array(
'body' => 'modules/cart/templates/ViewCart.tpl'));
    }
    
/**
     * @see GalleryView::getViewDescription()
     */
    
function getViewDescription() {
    list (
$ret$module) = GalleryCoreApi::loadPlugin('module''cart');

    if (
$ret) {
        return array(
$ret->wrap(__FILE____LINE__), null);
    }

    return array(
null$module->translate('view cart'));
    }

}
?>

Geändert von digifoho (10.07.06 um 12:50 Uhr).
  digifoho ist offline  
 
Alt 10.07.06, 12:39   #2 (permalink)
do ut des
 
Benutzerbild von Felix Jacobi tutorials.de Moderator 
 
Registriert seit: Nov 2001
Ort: Wuppertal
Beiträge: 4.785
Renommee-Modifikator: 54
Felix Jacobi hat die Renommee-Anzeige deaktiviert

AW: gallery / modul problem....

1. Halte dich bitte wie die Forenregeln vorgeben an die deutsche Rechtschreibung, dazu zählt auch die Groß- & Kleinschreibung.
2. Benutze bitte die richtigen Highlight Tags, in deinem Fall [ php] [/ php] (Natürlich ohne Leerzeichen)
3. Für solche Module empfiehlt es sicher eher die offiziellen Supportforen der jeweiligen Software zu benutzen, z. B. das hier:
Forum | Gallery
__________________
Der neue Personalausweis kommt...

KIDS Kinderbetreuungsdienst
Xing

They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin
  Felix Jacobi ist offline  
 
Alt 10.07.06, 12:56   #3 (permalink)
Mitglied
 
Registriert seit: May 2006
Beiträge: 17
Renommee-Modifikator: 0
digifoho hat eine blütenweiße Weste

AW: gallery / modul problem....

zu 1. Sorry - erledigt. (restliche Rechtschreibfehler/Tippfehler geschenkt)
zu 2. Sorry - erledigt.
zu 3. Ich hab mich da auch schon umgesehen und nichts gefunden. Und mein English ist nicht das beste
  digifoho ist offline  
 
Alt 10.07.06, 13:14   #4 (permalink)
Mitglied
 
Registriert seit: May 2006
Beiträge: 17
Renommee-Modifikator: 0
digifoho hat eine blütenweiße Weste

AW: gallery / modul problem....

Was mir auch weiter helfen würde: Ein Tutorial zu *.tpl Datein.
Finde dazu nichts.

Danke lg Simon
  digifoho ist offline  
 
Alt 10.07.06, 13:32   #5 (permalink)
do ut des
 
Benutzerbild von Felix Jacobi tutorials.de Moderator 
 
Registriert seit: Nov 2001
Ort: Wuppertal
Beiträge: 4.785
Renommee-Modifikator: 54
Felix Jacobi hat die Renommee-Anzeige deaktiviert

AW: gallery / modul problem....

tpl Dateien sind nichts anderes als Template Dateien und für Template Systeme gibt es keine General Tutorials, da jedes System unterschiedlich ist.
Das Problem ist, dass ich bezweifle dass es hier irgendwelche Spezialisten für dieses Gallery Project geben wird. Und man kann schwierig helfen, wenn man kein Backgroundwissen hat.
Und um die meisten Module zu verstehen brauch man eben dieses Wissen der Basisklasse was in deinem Fall die Gallery ist.

Ich kann dir nur raten, dich durch die Documentation zu arbeiten oder ggf. auf ein anderes System umzusteigen, auch wenn es schwierig sein wird

Hier was vorallem für dich interessant sein dürfte:
Gallery2:Tpl Reference - Gallery Codex

Übrigens benutzt deine Gallery das Smarty Template System, für das es auch eine deutsche Dokumentation gibt:
Smarty
__________________
Der neue Personalausweis kommt...

KIDS Kinderbetreuungsdienst
Xing

They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin
  Felix Jacobi ist offline  
 
Alt 10.07.06, 16:05   #6 (permalink)
Mitglied
 
Registriert seit: May 2006
Beiträge: 17
Renommee-Modifikator: 0
digifoho hat eine blütenweiße Weste

AW: gallery / modul problem....

Das klingt ja ziemlich doof...
aber danke trotzdem ich werd mir das mal anschaun
  digifoho ist offline  
 
Alt 10.07.06, 16:55   #7 (permalink)
Mitglied
 
Registriert seit: May 2006
Beiträge: 17
Renommee-Modifikator: 0
digifoho hat eine blütenweiße Weste

AW: gallery / modul problem....

danke felx für den Link!!
Der hilft ich glaub ich schaff das
Es ist gar nicht so schwer recht unkompliziert !!

DANKE DANKE DANKE DANKE
  digifoho ist offline  
 
Alt 10.07.06, 18:37   #8 (permalink)
do ut des
 
Benutzerbild von Felix Jacobi tutorials.de Moderator 
 
Registriert seit: Nov 2001
Ort: Wuppertal
Beiträge: 4.785
Renommee-Modifikator: 54
Felix Jacobi hat die Renommee-Anzeige deaktiviert

AW: gallery / modul problem....

Kein Problem, erledige das Thema bitte noch als 'Erledigt', danke.
__________________
Der neue Personalausweis kommt...

KIDS Kinderbetreuungsdienst
Xing

They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin
  Felix Jacobi ist offline  
 
 
 
Lesezeichen:


Themen-Optionen
Ansicht
Ähnliche Themen
 
Thema Autor Forum Antworten Letzter Beitrag
Problem ein Modul zu machen downset04 CGI, Perl, Python, Ruby 3 24.10.06 11:17
Gallery Problem tschimo PHP 13 05.12.05 10:27
Problem mit Perl Modul in CGI Script blackbirdthefirst CGI, Perl, Python, Ruby 1 26.11.04 12:26
Problem mit mod_auth_mysql Modul DJ_Apfel Hosting & Webserver 0 07.06.04 13:05
gallery script Problem Perforator PHP 1 31.01.03 13:33
» Tools
 
tutorials.de-Tools tutorial.de-Suchfeld tutorial.de-Widget tutorial.de-RSS-Feed tutorial.de-Banner
» Neue Links
 
Hits: 138
»
JHT's Planetary...
(Cinema 4D-Objekte)
Hits: 265
»
Tageslicht ohne GI
(Cinema 4D-Tutorials)
Hits: 153
»
Puzzle
(Cinema 4D-Tutorials)
Hits: 104
»
Lacreme
(Cinema 4D-Tutorials)
Hits: 195
»
Liquid Light
(Cinema 4D-Tutorials)
» Aktuelle Umfrage
 
Bist du mit der Geschwindigkeit der Tutorials.de-Website zufrieden?
Ja, es putzt mir glatt den Staub vom Bildschirm! - 80,51%
157 Stimmen
Nein, ich denke da muss noch nachgebessert werden... - 19,49%
38 Stimmen
Stimmen gesamt: 195
Du darfst bei dieser Umfrage nicht abstimmen.

 

Alle Zeitangaben in WEZ +1. Es ist jetzt 12:30 Uhr.


Powered by vBulletin® Version 3.8.5 (Deutsch) & vBadvanced CMPS v.3.2.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.5.0 RC2 ©2010, Crawlability, Inc.
Alle Rechte vorbehalten ©2000 - 2010 tutorials.de
Design by Mark, CSS by Maik & Sven Mintel
Seite generiert in 0,21176 Sekunden mit 26 queries