[TYPO3-german] Statische Seiten aus T3 erzeugen
Philipp Gampe
philipp.gampe at typo3.org
Tue Jun 19 17:54:51 CEST 2012
Hi Gerhard Obermayr,
Gerhard Obermayr wrote:
> Danke, das wäre ein gangbarer Weg.
> Der Server gehört mir selber und ich habe natürlich root-Zugriff.
> Ist PHP Version 5.2.6-1 + lenny16 + Suhosin Patch 0.9.6.2 +
> Zend Engine v2.2.0 + + + +
> Aber bei hunderten Seiten händisch die links ändern ???
Brauchst du nicht:
Auszug aus der man page:
-k
--convert-links
After the download is complete, convert the links in the document
to make them suitable for local viewing.
This affects not only the visible hyperlinks, but any part of the
document that links to external content,
such as embedded images, links to style sheets, hyperlinks to
non-HTML content, etc.
Each link will be changed in one of the two ways:
· The links to files that have been downloaded by Wget will be
changed to refer to the file they point
to as a relative link.
Example: if the downloaded file /foo/doc.html links to
/bar/img.gif, also downloaded, then the link in
doc.html will be modified to point to ../bar/img.gif. This
kind of transformation works reliably for
arbitrary combinations of directories.
· The links to files that have not been downloaded by Wget will
be changed to include host name and
absolute path of the location they point to.
Example: if the downloaded file /foo/doc.html links to
/bar/img.gif (or to ../bar/img.gif), then the
link in doc.html will be modified to point to
http://hostname/bar/img.gif.
Because of this, local browsing works reliably: if a linked file
was downloaded, the link will refer to
its local name; if it was not downloaded, the link will refer to
its full Internet address rather than
presenting a broken link. The fact that the former links are
converted to relative links ensures that you
can move the downloaded hierarchy to another directory.
Note that only at the end of the download can Wget know which
links have been downloaded. Because of
that, the work done by -k will be performed at the end of all the
downloads.
---------------------8<--------------
Mit -k hast du also entweder passende relative URLs oder eine absolute URL,
welche du ganz einfach ersetzen kannst.
Dann kannst du ganz einfach mit find und sed arbeiten:
find . -name "*.html" -type f |xargs sed -i "s#search#replace#g"
Der Befehl sucht alle Dateien (type f) mit dem Muster *.html (name *.html)
und führt auf jedem Resultat den stream edit (sed -i ...) Befehl aus. Dieser
ersetzt alle Folgen von search durch replace. Anstelle von # kannst du jedes
Zeichen verwenden, welches nicht im Suchmuster vorkommt.
Grüße
--
Philipp Gampe – PGP-Key 0AD96065 – TYPO3 UG Bonn/Köln
Documentation – linkvalidator
TYPO3 .... inspiring people to share!
More information about the TYPO3-german
mailing list