Change directory to HTML to understand src target

Asked

Viewed 410 times

0

I have the following structure:

/help/
    admin/
            index.php
    imagens/
            botoes/
                    botao1.jpg
                    botao2.jpg
    SISTEMA1/
                    paginas/
                                  pagina1.htm
                                  pagina2.htm
                    imagens/
                                  imagem1.jpg
                                  imagem2.jpg
    SISTEMA2/
                    paginas/
                                  pagina1.htm
                                  pagina2.htm
                    imagens/
                                  imagem1.jpg
                                  imagem2.jpg
    SISTEMA3/...

within the admin, I have the index.php, in it, I’m getting the content of pagina1.htm which is in the folder SISTEMA1/paginas/ through the php function file_get_contents()

MY PROBLEM

I have images in the archive pagina1.htm with the following src="":

src="../imagens/imagem1.jpg"
src="../imagens/botoes/botao1.jpg"

the image of botao appears, I mean, I’m inside the admin in my index.php going back a folder I get in imagens and inside images has the folder botoes. Only that the image imagem1.jpg I won’t find it, because it’s inside the folder SISTEMA1/imagens

that is, I needed to find a way to solve this, kkk, I tried to use the chdir() of PHP but I was unsuccessful, thank you

ALMOST RESOLVED

when I "print" the img appears, but when I put it inside a text editor it does not appear:

EXEMPLO

  • You are inside of admin, Isn’t it?! , have you tried going back to the folder? Ex: SISTEMA1/../admin/ I don’t understand your question right, repeat!

1 answer

1


Already tried to use tag base?

With it it is possible to set the base url for all page links.

Example:

<head>
   <base href="http://localhost/pasta/">
</head>
  • worked out! but, when I put the content in a text editor, it does not show aimagem, I "printing" the normal image it appears, but inside the editor ( I am using the ckeditor) it does not appear, it has some conflict?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.