如何从多个页面的内容创建并行输出? [英] How to create parallel output from content from many pages?

查看:105
本文介绍了如何从多个页面的内容创建并行输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要你的帮助...

I need your some help...

如何在一页中从多个页面创建并行输出,请参见示例:

How to create parallel output from many pages in one pages, see examples:

我将所有数据存储为纯文本格式,例如

I store all data in plain text e.g.

old-book-version.txt
1:1 dadidedodu....
1:2 cacecocuci....
2:1 papopupepi....
2:2 lalilolule....
2:3 and more......

mid-book-version.txt
1:1 dedadodedu....
1:2 cacicecuca....
2:1 popapepupi....
2:2 lalilolule....
2:3 and more......

new-book-version.txt
1:1 dudadidode....
1:2 cucacoceco....
2:1 pepipupapo....
2:2 lalilolule....
2:3 and more......

,我创建了php文件以将每个文件txt显示给网络浏览器 像:

and i create php file to show them to the web broser for each file txt like:

old-book-version.php to show old-book-version.txt, 
mid-book-version.php to show mid-book-version.txt,
new-book-version.php to show new-book-version.txt.

网址浏览器如下:

http://localhost/book/old-book-version.php/old-book-version.txt/2/1 output: 2:1 papopupepi.... 
http://localhost/book/mid-book-version.php/mid-book-version.txt/2/1 output: 2:1 popapepupi....
http://localhost/book/new-book-version.php/new-book-version.txt/2/1 output: 2:1 pepipupapo....

(.../2/1平均第2章第1节)

(.../2/1 mean chapter 2 verse 1)

一切运行良好,但我还想在一页中与下拉命令按钮选项进行比较来并行创建它们,这意味着我给访问者一个选项,以在一页中将每个版本进行并行比较.在Google上搜索后,我找到了示例

all running well but i also want to create them parallel in one page as comparison with drop down command button option, that mean i give an option to the visitor to compare each version as parallel in one page. after i search on the google i found the example

此致

推荐答案

您选择的内容可以进行更改

your select can have an onchange

< select onchange ="document.location = this.options [this.selectedIndex] .value">

<select onchange="document.location=this.options[this.selectedIndex].value">

< option value ="page1.php">页面#1</option>

<option value="page1.php">Page #1</option>

< option value ="page2.php">第2页</option>

<option value="page2.php">Page #2</option>

</select>

</select>

可以将它们全部串联起来,

To concatenate them all, you can do

$files = glob(dirname(__FILE__) . '/articles/*.txt');
foreach ($files as $f) {
  echo "<p>File $f:</p><pre>";
  readfile($f);
  echo '</pre>';
}

带有下拉菜单的表格可让您选择2个不同的来源,因此php脚本将根据所请求的来源来控制显示.您可以让用户点击提交"以提交表单,也可以在onchange事件中自动进行提交.

that form with the dropdowns lets you select 2 different sources, so the php script will control the display based on the requested sources. you can let the user hit "submit" to submit the form or you can automatically do it in the onchange event.

First: <select name="source[]"><option value="s1">Source #1</option></select>

Second: <select name="source[]"><option value="s1">Source #1</option></select>

for($ i = 0; $ i< count($ _ REQUEST ['source']); ++ $ i){ printText($ _ REQUEST ['source'] [$ i]; }

for ($i = 0; $i < count($_REQUEST['source']); ++$i) { printText($_REQUEST['source'][$i]; }

函数printText($ source) { $ file = dirname( FILE ). "/texts/$source/something.txt"; $ text = file_get_contents($ file); 回显"$ text"; }

function printText($source) { $file = dirname(FILE) . "/texts/$source/something.txt"; $text = file_get_contents($file); echo "$text"; }

这篇关于如何从多个页面的内容创建并行输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆