TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-04-2008, 12:37 AM   #1 (permalink)
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Smile Create Content with XML and parse...

Hi all,

got a quick question. I work with a static site that i am trying to streamline. I was thinking of saving every thing content wise in XML and parsing it per page. What "anchor" on the page should I use? the Title? or??? to call the XML. Also, do you think this is a good idea?

Thanks!
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote
Old 04-04-2008, 02:46 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I would take the file-name to find the corresponding XML file. You will need to normalise the file-name, so remove any unnecessary slashes, et cetera. And make sure if it cannot find the XML file, it fails gracefully. Don't forget to check for an empty file-name and default to index!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 04-04-2008, 02:33 PM   #3 (permalink)
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Default

Thanks for the reply. So maybe check it like this (psuedo):

Code:
filenames:

index.xml
index.php

template:

{header}

{
get filename minus extension;
get xml with same filename minus extension;
  if(!filename.xml)
    $content = index.xml
   }else{
    $content = filename.xml
  }
}

{footer}
I just thought of something... I have many different folders with index.php in them....

I have been thinking for a while how to streamline this non-dynamic site i have. I wish it had more structure. I don't have access to nor am allowed to use a database or sqlite. Maybe I just have to suck it up.
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote
Old 04-04-2008, 04:32 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I have wrote this function which may be helpful. It will take the current script path and convert the directory slashes into underscores, so you can put all the XML files in one place.

Index.php file in root: ./xml/index.xml
Index.php file in folder: ./xml/folder_index.xml

php Code:
function getXMLFilename($szXMLPath = './xml', $szPathSep = '/', $szFileSep = '_')
{
    $szDocRoot = $_SERVER['DOCUMENT_ROOT'];
    $szScript = str_replace($szDocRoot, '', $_SERVER['SCRIPT_FILENAME']);

    if(substr($szScript, 0, 1) == $szPathSep)
    {
        $szScript = substr($szScript, 1);
    }
   
    $szScript = str_replace($szPathSep, $szFileSep, $szScript);
    $szScript = $szXMLPath . '/' . preg_replace('~\..+$~i', '.xml', strtolower($szScript));

    if(!file_exists($szScript))
    {
        return false;
    }
   
    return $szScript;
}
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
buildakicker (04-04-2008)
Old 03-05-2013, 07:44 AM   #5 (permalink)
The Acquainted
 
Join Date: Mar 2013
Posts: 112
Thanks: 0
jersey wholesale is on a distinguished road
Default

[http://www.nflcnshop.net],Nike NFL Jerseys,Wholesale NFL Jerseys, Cheap nba jerseys,Wholesale 2013 NBA All Star ,Nike NFL Jerseys,Football Jerseys Cheap,Cheap NFL jerseys, nfl jerseys from china,Cheap Nike NFL Jerseys,NFL Jerseys By Nike,Cheap Jerseys Wholesale,Buy Cheap Nike Jerseys,Wholesale MLB Jerseys,Cheap NFL Hats,jersey store, jersey wholesale,steelers jersey,packers jersey, jersey wholesale,new nike nfl jerseys,nfl jerseys for sale
jersey wholesale is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:18 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design