首页 \ 问答 \ 如何将相同的内容应用于多个html页面(How to apply same content to multiple html pages)

如何将相同的内容应用于多个html页面(How to apply same content to multiple html pages)

我是html的新手,想知道是否有办法将同一内容同时应用于多个html文件。

例如,如果我有很多页面,但所有这些页面都有相同的导航侧面板,其中包含指向所有其他页面的链接。 是否有任何方法可以更改此侧面板的内容而无需为每个单独的页面更改它? 即是否有一个功能,允许我在单独的文件中创建此导航面板,然后告诉我的所有页面包含此导航文件?

我知道一个css文件可以控制许多html页面的格式 - 有没有类比可以控制许多html页面的内容?


I'm new to html and was wondering if there is a way to apply the same content to many html files at once.

For example, if I have many pages, but all those pages have an identical navigation side panel that contains links to all the other pages. Is there any way to change the contents of this side panel without changing it for each individual page? i.e. is there a feature that allows me to make this navigation panel in a separate file, then tell all my pages to include this navigation file?

I know a css file can control the format of many html pages - is there an analogy to this that can control the content of many html pages?


原文:https://stackoverflow.com/questions/8548738
更新时间:2024-05-22 20:05

最满意答案

试试这个完整的代码:

$images = glob($volumePath."*");
foreach($images as $key => $image) {
    $path = str_replace('C:\xampp\htdocs\\', '../', $image);
    $path2 = str_replace(' ', '%20', $path);
    $file = "<img src='".$path2."'/>";
    echo $file;
}

请注意$file变量中的单引号,修改后的foreach语句和$path的单个$image变量


Try this complete code:

$images = glob($volumePath."*");
foreach($images as $key => $image) {
    $path = str_replace('C:\xampp\htdocs\\', '../', $image);
    $path2 = str_replace(' ', '%20', $path);
    $file = "<img src='".$path2."'/>";
    echo $file;
}

Note the single quotes in the $file variable, the modified foreach statement and the single $image variable in $path

相关问答

更多
  • 尝试这个: BitmapImage image = new BitmapImage(new Uri("/MyProject;component/Images/down.png", UriKind.Relative)); Try this: BitmapImage image = new BitmapImage(new Uri("/MyProject;component/Images/down.png", UriKind.Relative));
  • 将用户ID存储在一个隐藏字段中 更新数据库中的值后,可以使用ajax从php页面获取respone
    $(document).ready(function(){ $('#getimage').click(function() { ...
  • 这很可能是由于LoadImage库调用URL.revokeObjectURL()以释放分配的映像。 尝试指定 noRevoke选项。 This is most likely due to the LoadImage library calling URL.revokeObjectURL() in order to release the allocated image. Try to specify the noRevoke option.
  • 如果图像位于应用程序资源中,则可以这样做: pb.Image = Properties.Resources.a If the image is in your application's resources, you can do that : pb.Image = Properties.Resources.a
  • 这是做到这一点的正确方法。 如果您想要缓存图像供以后重复使用,可以随时将其下载到独立存储中。 将WebClient与OpenReadAsync - 传递图像URI并将其存储在本地。 WebClient client = new WebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(new Uri("IMAGE_URL" ...
  • 试试这个完整的代码: $images = glob($volumePath."*"); foreach($images as $key => $image) { $path = str_replace('C:\xampp\htdocs\\', '../', $image); $path2 = str_replace(' ', '%20', $path); $file = ""; echo $file; } 请注意$file变量中 ...
  • 有时我会花更多的时间来搜索:) 我找到了解读这篇文章的答案,它对我来说很好: // The server says, it should be *.png String picName = getPictureFromServer(); picName = picName.replace(".png", ""); Resources r = getResources(); int picId = r.getIdentifier(picName, "drawable", "com.mypackage.mya ...
  • 你的意思是img而不是image ,是的,你可以尝试: $('#Imagespan').find('img').attr('src'); //or also $('#Imagespan').find('img').prop('src'); 或使用直接选择器,如: $('#Imagespan img').prop('src'); 注意:如果元素是动态创建的,则获取“属性/属性”的方法是相同的。 .attr()更改该HTML标记的属性。 .prop()根据DOM树更改该HTML标记的属性。 正如此链接中的示 ...
  • 你不能将xml String getTag转换为Integer,因为getTag方法实际上并没有返回你想要做的drawable id,但我看到你想要显示一个黑色的车。 这让我觉得你正在制作一个国际象棋应用程序。 棋子本身应该是一个物体,称为“白嘴鸦”。 在这个“Rook”对象中,您可以拥有一个ImageView,然后为此对象ImageView创建getter和setter。 然后,要获得ImageView,您可以简单地执行此操作: Rook blackRook = new Rook(); blackRook ...
  • 根据您的评论,您似乎正在尝试生成要通过电子邮件发送的html文件。 最好创建一个带有place holders的html文件,以获取要注入的信息。 使用文本阅读器从文件中读取html,并在文本上使用regex或string.replace替换实际值的place holders 。 您需要拥有图像的完整URL。 例如 阅读HTML var HTML = EmailTemplate.GetHTMLFromTemplate(path to template) public static string GetH ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)