Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image Drupal 6模板-在预处理中更改图像路径的更好建议?_Image_Templates_Drupal_Drupal 6_Preprocessor - Fatal编程技术网

Image Drupal 6模板-在预处理中更改图像路径的更好建议?

Image Drupal 6模板-在预处理中更改图像路径的更好建议?,image,templates,drupal,drupal-6,preprocessor,Image,Templates,Drupal,Drupal 6,Preprocessor,我必须在一个Drupal中更改模板 在每个“页面”节点类型上,CCK字段中存储一个图像。我制作了新的设计模板,通过CSS改变设计。但现在客户的需求是只在我的新设计模板中更改名为“field_obr”(每个节点一个)的CCK字段中的图像。他可以切换主题,图像将与主题对应(当前设计=来自CCK的原始图像,新设计=来自原始CCK字段路径的更改路径的图像)。图像名称可以相同,只有目录发生了更改 原始图像存储在以下文件夹中: sites/default/files/image1.jpg sites/def

我必须在一个Drupal中更改模板

在每个“页面”节点类型上,CCK字段中存储一个图像。我制作了新的设计模板,通过CSS改变设计。但现在客户的需求是只在我的新设计模板中更改名为“field_obr”(每个节点一个)的CCK字段中的图像。他可以切换主题,图像将与主题对应(当前设计=来自CCK的原始图像,新设计=来自原始CCK字段路径的更改路径的图像)。图像名称可以相同,只有目录发生了更改

原始图像存储在以下文件夹中:

sites/default/files/image1.jpg
sites/default/files/image2.jpg
...
我想在新主题中将图像的路径更改为:

sites/default/files/new_img/image1.jpg
sites/default/files/new_img/image2.jpg
...
=在图像之前的路径中添加“/new\u img”文件夹。(或者我的模板文件的稍后路径-thac我知道怎么做,但我在这里寻找原理。)

模板将图像输出为:

 <img  class="imagefield imagefield-field_obr" width="229" height="346" alt="" src="/sites/default/files/radek_home_0.jpg?1354577633" /> 
我在docu中发现,这些函数适用于Drupal 7+:-(

问题: 有人能告诉我解决开头描述的情况的最佳解决方案吗?如何通过profi“Drupal方式”实现它 非常感谢。
Frantisek

我做了一些研究,Drupal 6为所描述的问题找到了一个简单可行的解决方案。它是位于模板
页面.tpl.PHP
中提到的PHP函数:

print preg_replace('#/sites/default/files/#', '/sites/default/files/_new/', $content);
print preg_replace('#/sites/default/files/#', '/sites/default/files/_new/', $content);