I have many pages with a unique short paragraph description for that page. Is it possible to have one text file for all of these paragraphs, and that each page could grab the appropriate paragraph from this one text file? I thought xml or AJAX might be the answer, but I'm not sure. I'd rather not have one text file for each html/php/whatever page, as that kind of defeats the intention of one easy file to edit. I've been looking for something like this for days, and have done lots of research, but can't quite come up with this method. And, of course, the text that shows up on the page needs to be searchable.
I'm open to any solution, and would welcome any suggestions.
Thanks in advance.
5 1375
this depends on how you build each page.
You can insert via php an paragraph from one xml file using xslt (this is how I do it on my website). but I'm not familiar with searches.
I was initially thinking xml and DOM parser.
XML Text file would be something like:
<page1Paragraph>This is the text that goes on page 1.</page1Paragraph>
<page2Paragraph>This is the text that goes on page 2.</page2Paragraph>
<page3Paragraph>This is the text that goes on page 3.</page3Paragraph>
etc.
Then have a loadXMLDoc function on each page with a <pageXParagraph>div.
I can't get it to work, though, and wondered if anyone had any ideas on this, or perhaps a better way to do it.
Everyone on this board seems sharp and well-rounded, so it looked like the best place to ask.
I found this script, but, while it worked locally, oddly, it didn't work when I tried it on a server. It's exactly what I need. (Except, of course, that it doesn't quite work.) http://www.tek-tips.com/viewthread.c...443973&page=10
By searchable, I simply mean that I want the text embedded in the html, not like an iframe or Spry.
Thanks for your help.
have you any means to find out why the script does not work on the server? (personally, I use the Firebug plugin for Firefox) My guess is, that maybe the XML file is not loaded correctly.
It works locally only in Safari, not even in Firefox. Doesn't work on anything from the server. I'm ready to give up.
Doesn't anyone have some scripts that do this? DOM Parser, HTTPRequest? My pages are php.
Thanks!
Ok, one possible solution using XSL:
part 1 - designing the xml file
this strongly depends on how you identify each page. You said you have quite a lot pages I recomment identification by id attribute (or similar). - <!-- DTD here if needed -->
-
<desc>
-
<page id="1"><!-- description goes here --></page>
-
...
-
</desc>
of course you can use any id value you like (e.g. numbers, characters, random strings)
part 2 - writing xsl
you get the <page> element you want by selecting the appropriate id. - <!-- xsl header declaration -->
-
<xsl:param name="page">default value</xsl:param>
-
-
<xsl:template match="/">
-
<p><xsl:value-of select="child::page[@id=$page]" /></p>
-
</xsl:template>
note: you have to set the <xsl:param> through php to get the desired result. the default is only a fallback.
part 3 - putting it all together
important note: as I'm using php4, xsl processing is quite different to php5, if you're using that please look up the xsl processing on www.php.net.
this function combines the xml and xsl and returns the result thereof. you might want to check, if there was an error or not. - $handle = xslt_create();
-
echo xslt_process($handle, $yourXML, $yourXSL, NULL, array(), array('page' => $pageid));
-
xslt_free($handle);
the thing you have to develop is how each site is connected to the ids in the xml file
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Gemini |
last post by:
Hello
I am looking for the best content/article manager software, perferred
open
source, php, mysql backend..
can anyone recommend me one?
I think that the best discussion is phpbb, the...
|
by: Roman Suzi |
last post by:
;-)
Just type into google
"best programming language"
and press (I am lucky)
Sincerely yours, Roman Suzi
--
rnd@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their...
|
by: Irene |
last post by:
Hi all,
I have set up a simple VB program (and later on an ASP interface) to
manage an Athletics database. I'm using Access 2000.
To simplify, I have the Athlets, the Competitions and the...
|
by: l.woods |
last post by:
I want your recommendation on which ASP.NET Shopping Cart software I should
buy?
Best code
Best documentation
Best support (if needed. I will buying source code, if possible)
TIA,
Larry...
|
by: Ron Brennan |
last post by:
Good evening,
Windows 2000, JDK 1.5.
What opinions do people have on what way and tool programmaticly produces
the best quality thumbnails from larger images?
On the web I've seen Java...
|
by: Frank Millman |
last post by:
Hi all
Assume a 2-dimensional list called 'table' - conceptually think of it
as rows and columns.
Assume I want to create a temporary copy of a row called 'row',
allowing me to modify the...
|
by: optimistx |
last post by:
Which url in your opinion would be a good or even the best example of
javascript usage in a set of pages at least say 10 or more pages? How to use
css, how to split js-code to files, how to code...
|
by: Earl |
last post by:
I have all of my data operations in a separate library, so I'm looking for
what might be termed "best practices" on a return type from those classes.
For example, let's say I send an update from...
|
by: =?Utf-8?B?QW1tZXI=?= |
last post by:
I've read many incomplete opinions about the "Best Practice" for securely
accessing SQL but what I really need to find the "Best Practice" that fits my
applications needs.
Currently (alpha...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |