Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    60

    Devo modificare una pagina ma non riesco...

    Salve a tutti.


    Ho un forum SMF.

    I link all'interno del forum sono di questo tipo


    ......./index.php?action=xxxxxx

    Dove per "xxxxxx" sta il nome dell'azione che sto compiendo, come register ad esempio se sto registrandomi.

    Ora io vorrei inserire delle pagine in html che abbiano lo stesso stile del forum.

    E ho capito anche come fare a cambiare il link in

    ....../index.php?action=quellochevoglioio

    Il problema è uno solo: non riesco a modificare il file di sorgente (nella cartella Sources sono presenti tutti i file che corrispondono all'azione: ad esempio se vi sarà una pagina ".....index.php?action=links" corrisponderà nella cartella il file Links.php)

    Qualcuno se posto uno di questi file sarebbe così gentile da modificarmelo in modo che mi dica solo dove inserire il codice html?

    Ve ne sarei grato....

    Attendendo una risposta,
    Vi porgo
    Cordiali Saluti

  2. #2
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    60
    Ho provato ma mi dice

    Si è verificato un errore!
    Impossibile caricare il modello 'main'.

    Che vuol dire? Qualcuno mi aiuta?

  3. #3
    accetto la sfida..dai!!!

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    60
    Questo è uno dei file (ho scelto il più corto)


    Notify.php


    Codice PHP:
    <?php
    /**********************************************************************************
    * Notify.php                                                                      *
    ***********************************************************************************
    * SMF: Simple Machines Forum                                                      *
    * Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com)                    *
    * =============================================================================== *
    * Software Version:           SMF 1.1                                             *
    * Software by:                Simple Machines ([url]http://www.simplemachines.org[/url])     *
    * Copyright 2006 by:          Simple Machines LLC ([url]http://www.simplemachines.org[/url]) *
    *           2001-2006 by:     Lewis Media ([url]http://www.lewismedia.com[/url])             *
    * Support, News, Updates at:  [url]http://www.simplemachines.org[/url]                       *
    ***********************************************************************************
    * This program is free software; you may redistribute it and/or modify it under   *
    * the terms of the provided license as published by Simple Machines LLC.          *
    *                                                                                 *
    * This program is distributed in the hope that it is and will be useful, but      *
    * WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
    * or FITNESS FOR A PARTICULAR PURPOSE.                                            *
    *                                                                                 *
    * See the "license.txt" file for details of the Simple Machines license.          *
    * The latest version can always be found at [url]http://www.simplemachines.org.[/url]        *
    **********************************************************************************/
    if (!defined('SMF'))
        die(
    'Hacking attempt...');

    /*    This file contains just the functions that turn on and off notifications to
        topics or boards. The following two functions are included:

        void Notify()
            - is called to turn off/on notification for a particular topic.
            - must be called with a topic specified in the URL.
            - uses the Notify template (main sub template.) when called with no sa.
            - the sub action can be 'on', 'off', or nothing for what to do.
            - requires the mark_any_notify permission.
            - upon successful completion of action will direct user back to topic.
            - is accessed via ?action=notify.

        void BoardNotify()
            - is called to turn off/on notification for a particular board.
            - must be called with a board specified in the URL.
            - uses the Notify template. (notify_board sub template.)
            - only uses the template if no sub action is used. (on/off)
            - requires the mark_notify permission.
            - redirects the user back to the board after it is done.
            - is accessed via ?action=notifyboard.
    */

    // Turn on/off notifications...
    function Notify()
    {
        global 
    $db_prefix$scripturl$txt$topic$ID_MEMBER$context;

        
    // Make sure they aren't a guest or something - guests can't really receive notifications!
        
    is_not_guest();
        
    isAllowedTo('mark_any_notify');

        
    // Make sure the topic has been specified.
        
    if (empty($topic))
            
    fatal_lang_error(472false);

        
    // What do we do?  Better ask if they didn't say..
        
    if (empty($_GET['sa']))
        {
            
    // Load the template, but only if it is needed.
            
    loadTemplate('Notify');

            
    // Find out if they have notification set for this topic already.
            
    $request db_query("
                SELECT ID_MEMBER
                FROM 
    {$db_prefix}log_notify
                WHERE ID_MEMBER = 
    $ID_MEMBER
                    AND ID_TOPIC = 
    $topic
                LIMIT 1"
    __FILE____LINE__);
            
    $context['notification_set'] = mysql_num_rows($request) != 0;
            
    mysql_free_result($request);

            
    // Set the template variables...
            
    $context['topic_href'] = $scripturl '?topic=' $topic '.' $_REQUEST['start'];
            
    $context['start'] = $_REQUEST['start'];
            
    $context['page_title'] = $txt[418];

            return;
        }
        elseif (
    $_GET['sa'] == 'on')
        {
            
    checkSession('get');

            
    // Attempt to turn notifications on.
            
    db_query("
                INSERT IGNORE INTO 
    {$db_prefix}log_notify
                    (ID_MEMBER, ID_TOPIC)
                VALUES (
    $ID_MEMBER$topic)"__FILE____LINE__);
        }
        else
        {
            
    checkSession('get');

            
    // Just turn notifications off.
            
    db_query("
                DELETE FROM 
    {$db_prefix}log_notify
                WHERE ID_MEMBER = 
    $ID_MEMBER
                    AND ID_TOPIC = 
    $topic
                LIMIT 1"
    __FILE____LINE__);
        }

        
    // Send them back to the topic.
        
    redirectexit('topic=' $topic '.' $_REQUEST['start']);
    }

    function 
    BoardNotify()
    {
        global 
    $db_prefix$scripturl$txt$board$ID_MEMBER$user_info$context;

        
    // Permissions are an important part of anything ;).
        
    is_not_guest();
        
    isAllowedTo('mark_notify');

        
    // You have to specify a board to turn notifications on!
        
    if (empty($board))
            
    fatal_lang_error('smf232'false);

        
    // No subaction: find out what to do.
        
    if (empty($_GET['sa']))
        {
            
    // We're gonna need the notify template...
            
    loadTemplate('Notify');

            
    // Find out if they have notification set for this topic already.
            
    $request db_query("
                SELECT ID_MEMBER
                FROM 
    {$db_prefix}log_notify
                WHERE ID_MEMBER = 
    $ID_MEMBER
                    AND ID_BOARD = 
    $board
                LIMIT 1"
    __FILE____LINE__);
            
    $context['notification_set'] = mysql_num_rows($request) != 0;
            
    mysql_free_result($request);

            
    // Set the template variables...
            
    $context['board_href'] = $scripturl '?board=' $board '.' $_REQUEST['start'];
            
    $context['start'] = $_REQUEST['start'];
            
    $context['page_title'] = $txt[418];
            
    $context['sub_template'] = 'notify_board';

            return;
        }
        
    // Turn the board level notification on....
        
    elseif ($_GET['sa'] == 'on')
        {
            
    checkSession('get');

            
    // Turn notification on.  (note this just blows smoke if it's already on.)
            
    db_query("
                INSERT IGNORE INTO 
    {$db_prefix}log_notify
                    (ID_MEMBER, ID_BOARD)
                VALUES (
    $ID_MEMBER$board)"__FILE____LINE__);
        }
        
    // ...or off?
        
    else
        {
            
    checkSession('get');

            
    // Turn notification off for this board.
            
    db_query("
                DELETE FROM 
    {$db_prefix}log_notify
                WHERE ID_MEMBER = 
    $ID_MEMBER
                    AND ID_BOARD = 
    $board
                LIMIT 1"
    __FILE____LINE__);
        }

        
    // Back to the board!
        
    redirectexit('board=' $board '.' $_REQUEST['start']);
    }

    ?>
    Devo fare in modo che si carichi solo il template e metti come codice html uno a caso tipo <font etc etc... poi modifico io

    Grazie mille

  5. #5
    vedo che fra le altre c'è la riga

    loadTemplate('Notify');

    com'è il codice di quella funzione?

  6. #6
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    60
    Questo è il codice di Notify.template.php (file di template di Notify)

    Codice PHP:
    <?php
    // Version: 1.1; Notify

    function template_main()
    {
        global 
    $context$settings$options$txt$scripturl;

        echo 
    '
                <table border="0" width="100%" cellspacing="0" cellpadding="3" class="tborder">
                    <tr class="titlebg">
                        <td>'
    $txt[125], '</td>
                    </tr>
                    <tr class="windowbg">
                        <td>
                            '
    $context['notification_set'] ? $txt[212] : $txt[126], '

                            

                            [b][url="'
    $scripturl'?action=notify;sa='$context['notification_set'] ? 'off' 'on'';topic='$context['current_topic'], '.'$context['start'], ';sesc='$context['session_id'], '"]'$txt[163], '[/url] - [url="'$context['topic_href'], '"]'$txt[164], '[/url][/b]
                        </td>
                    </tr>
                </table>'
    ;
    }

    function 
    template_notify_board()
    {
        global 
    $context$settings$options$txt$scripturl;

        echo 
    '
                <table border="0" width="100%" cellspacing="0" cellpadding="3" class="tborder">
                    <tr class="titlebg">
                        <td>'
    $txt[125], '</td>
                    </tr>
                    <tr class="windowbg">
                        <td>
                            '
    $context['notification_set'] ? $txt['notifyboard_turnoff'] : $txt['notifyboard_turnon'], '

                            

                            [b][url="'
    $scripturl'?action=notifyboard;sa='$context['notification_set'] ? 'off' 'on'';board='$context['current_board'], '.'$context['start'], ';sesc='$context['session_id'], '"]'$txt[163], '[/url] - [url="'$context['board_href'], '"]'$txt[164], '[/url][/b]
                        </td>
                    </tr>
                </table>'
    ;
    }

    ?>

  7. #7
    direi che la chiave è tutta qua , proprio nel template..come vedi vengono usate variabili globali per "completare" la table html

    global $context, $settings, $options, $txt, $scripturl;

    quindi direi che basta cambiare il contenuto di queste variabili e fare qualcosa tipo

    <?php
    include 'config.php';
    include 'template.php';
    ?>
    <html>
    <head><title></title></head>
    <body>
    <?php if (('notify') template_notify_board(); else template_main(); ?>
    </body>
    </html>

    in CONFIG.PHP ci metti tutti i valori necessari delel variabili global e in template.php le funzioni di template

  8. #8
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    60
    Scusami ma di php non ci capisco proprio nulla... cosa dovrei fare di preciso?

  9. #9
    Utente di HTML.it
    Registrato dal
    Dec 2004
    Messaggi
    60
    Ah ho capito devo fare due file

    cioè

    Config.php

    in cui inserisco:

    Codice PHP:
    global $context$settings$options$txt$scripturl
    e Template.php

    in cui inserisco:

    Codice PHP:
    loadTemplate('quellocheè'); 

    Giusto?

  10. #10
    in config.php dovresti inserire i VALORI delle variabili globali, e se vuoi il template.php puoi lasciarlo così come è o aggiungere altri tag tenendo però presente i valori delle variabili globals

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.