如何将相同的内容应用于多个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
最满意答案
试试这个完整的代码:
$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 modifiedforeach
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));
-
从php引用图像(referencing an image from php)[2022-03-02]
将用户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.
-
图像源winforms(Image source winforms)[2023-02-12]
如果图像位于应用程序资源中,则可以这样做: pb.Image = Properties.Resources.a If the image is in your application's resources, you can do that : pb.Image = Properties.Resources.a -
将图像源设置为URI(Set image source to a URI)[2023-12-08]
这是做到这一点的正确方法。 如果您想要缓存图像供以后重复使用,可以随时将其下载到独立存储中。 将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 ...