Hi

You dream solution, is the solution that I implemented.  However, I don't
use phpquery, I used simple_html_dom (I like how it feels like jquery).  As
you mentioned css url's do not change, I am looking into a possible
solution to this.

Thank you for the phpquery reference, looks promising.

Best regards,
Levi Stanley

On Fri, Nov 4, 2011 at 9:26 AM, adobebi...@gmail.com
<adobebi...@gmail.com>wrote:

> Hi,
>
> I have been thinking for months on this issue and tried several things,
>
> One is within codeigniter, creating an assetmanager controller class and
> use its action to navigate the design time url to runtime url ... The code
> is most bottom of this message. And note that I didn't like and use it,
> because it uses ugly redirect command for each url, but in theori it is
> working.
>
> Other theory is using server shortcuts for runtime url access. It is
> better than using redirect command but it needs server configuration, and
> not an ellastic solution especially you need to create multiple template
> based projects require new templates and assets folder dymamicly created
> continously...
>
> The last trick which I so far desided to use is using ${imagepath} as the
> forlder name. So in design time, or while opening directly template html
> file, for example an image tag
> <img src='${imagepath}/image1.png'>. In windows, I can make my image
> assets folder name as ${imagepath} and it works in linux server... This
> always works except dreamweaver design time for in css files like this
> example definition   .style1 { background:url(${imagepath}/image1.png)}
> because of the braces inside braces.
>
> Above them are still ugly solutions for me.
>
> What I dreamed soluiton is that, enhancing phptal dom capability to read
> the attrybute values in templates and to set them for runtime working. So
> that our desing time url, special-folder-name-for-assets in <img
> src="special-folder-name-for-assets/icons/ico.png"> will output like
> "application/views/special-folder-name-for-assets/icons/ico.png". Yet, this
> does not solver urls in css files. But does a lot of ugly work as well as
> other dom operations. It would be very nice if enhancing phptals dom
> capability using phpquery <http://code.google.com/p/phpquery/>.
>
>
> #Apache Configuration
> <VirtualHost 127.0.0.1:80>
>   ServerName ....
>   DocumentRoot "..."
>   DirectoryIndex index.php
>   ....
>   *Alias /images
> C:\wamp\www\socialdoctorpages\subwork\testci\application\views\images*
> </VirtualHost>
>
> //Assetmanager Class
> class Assetmanager extends Controller {
>     function __construct() {
>         parent::__construct();
>         $this->load->library('Tal');
>         //prepare global page tal data
>  $this->tal->base_url = base_url(); //'${base_url}';
> $this->tal->tpl_path = $this->tal->template_repository;
>  $this->tal->assets  =  $this->tal->template_repository . '/${assets}';
> //'${assets}';
>  $this->tal->tpl_full_path = base_url() . $this->tal->template_repository
> . '/';
> $this->tal->globalpage = 'layout_main.html/globalpage';
>      }
>
>   function template_assets($path) {
> //echo $path . '<br />';
>  //echo $this->uri->uri_string . '<br />';
> //echo $this->uri->ruri_string() . '<br />';
>  $target = $this->tal->template_repository . $this->uri->uri_string;
>  //echo $target;
> redirect($target);
>  //header('Content-Type: image/jpeg');
> //echo file_get_contents($target);
>  }
>  function global_assets($path) {
>  echo 'Target file not found: ' . $this->uri->uri_string;
>  //print_r('application/views/default' . $this->uri->uri_string());
> //redirect('application/views/default' . $this->uri->uri_string());
>  //header('Content-Type: image/jpeg');
> //echo file_get_contents('application/views/default' .
> $this->uri->uri_string());
>  //redirect('application/views/default' . $this->uri->uri_string());
>  }
> }
>
>
>
> On Thu, Nov 3, 2011 at 10:00 AM, romtek <rom...@gmail.com> wrote:
>
>> Hi,
>>
>> The nature of the development approach that I use is that paths to
>> resources (images, CSS and JS files, etc.) relative to the template files
>> during design time are different from those during run time. (I have
>> templates in a separate folder, but my web app runs as index.php in the
>> root folder.)
>>
>> I like to see preview of a page I work on in Design view of Expression
>> Web or Dreamweaver, and so in order to have images, etc. point to proper
>> paths during design time and also during run time, I do something like this
>> in my templates:
>>
>> <img tal:attributes="src
>> string:${resourcesDir}/shared/images/menu_bar.jpg"
>> src="../../resources/shared/images/menu_bar.jpg" />
>>
>> This increases workload, makes code less readable, and is error prone
>> during modifications.
>>
>> How do you, guys, deal with this issue, if you do? Maybe there's a trick
>> that I haven't thought of. I've tried using <base> element, but Dreamweaver
>> ignores it, and Expression Web messes up my code. By the way, this problem
>> isn't limited to those who use PHPTAL but, apparently, is also shared by
>> some of those who Code Igniter (and, I am sure, other frameworks that
>> require a structure of folders):
>> http://codeigniter.com/forums/viewthread/94591/#478998
>>
>> Roman
>>
>> _______________________________________________
>> PHPTAL mailing list
>> PHPTAL@lists.motion-twin.com
>> http://lists.motion-twin.com/mailman/listinfo/phptal
>>
>>
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to