Re: Links and Images with correct path from pure html

2007-03-26 Thread dima

Korcs,

Thanks for re-posting on the Group :)

Could you provide some additional code?

>From what I can tell, you would need a custom helper like so:

class CustomHelper
{
   function parseAnchors($content)
   {
  // Replaces all anchors locations to an absolute value.
  return preg_replace_callback('href="([^"]+)"', array($this,
'__parseAnchorsCallback'));
   }

   function __parseAnchorsCallback($matches)
   {
  // $this->siteRoot is the absolute path of your pages.
  // e.g. / or http://domain.com/
  return 'href="' . $this->siteRoot . $matches[1] . '"';
   }

   function linkToImage()
   {
  // Same as for the anchors, but with a different root...
   }
}

And in your view, you would do something like so

parseAnchors($this->data['Page']
['content']) ?>

But from what you've written, you are already doing this (?)

Dimitry Z.


On Mar 26, 12:07 pm, "korcs" <[EMAIL PROTECTED]> wrote:
> Hi Bakers,
>
> I am working on a refactoring project for an existing cms andI have
> decided to make it using cake.
>
> The CMS has an existing database with
> thousands of articles, stored basically as HTML code, where all the
> links and images appear as HTML tags like  relative links. (f.e.
> I want to implement the editing function of the new cake based CMS by
> using tinyMCE and faced the problem that it is quite a hard nut to get
> my images and links displayed correctly at the front end.
>
> I think that the solution should be to parse the html code before
> displaying and replace the  helper.
> This would be a solution for displaying the images and links when
> viewing a page, but I am afraid that this still don't solve the
> problem, that the images are not showing up in the tinyMCE editor
> while editing...
>
> If someone already had the same problem and has a "baked" solution,
> would be great if he would share it with me and other bakers who are
> struggeling with the this issue.
>
> Thanks,
>
> korcs


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Links and Images with correct path from pure html

2007-03-26 Thread korcs

Hi Bakers,

I am working on a refactoring project for an existing cms andI have
decided to make it using cake.

The CMS has an existing database with
thousands of articles, stored basically as HTML code, where all the
links and images appear as HTML tags like http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---