Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Dateien in einem Pfad auslesen, using Smarty

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Braindea7
Smarty n00b


Joined: 11 May 2017
Posts: 3

PostPosted: Thu May 11, 2017 3:06 pm    Post subject: Dateien in einem Pfad auslesen, using Smarty Reply with quote

Servus,

nach der Suche hier im Forum und auch bei Google.de bin ich immernoch ratlos..
Ich finde keinen hilfreichen Tipp für mein Problem...

Ich habe mehrere Pfade in denen jeweils immer nur eine .jpg liegt. Die .jpg heißen allerdings immer anders. Einfluss habe ich darauf nicht.
Daher suche ich eine Methode, die mir jeweils den Namen der .jpg liefert. Damit könnte ich dann den kompletten Pfad für die <img> angeben.

Hättet ihr eine Idee dazu?
Ich bin blutiger Anfänger mit Smarty und arbeite nun gezwungener Maßen damit.. Den Rest habe ich soweit schon hingebastelt. Nur dazu fällt mir nichts ein und ich finde auch nichts..

Grüße,
Max
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu May 11, 2017 3:46 pm    Post subject: Reply with quote

This is not a Smarty question. Smarty is a templating engine, not a programming language, nor it is a server management software or a file finding tool.
If you don't have control of your server and your application code, find a better server and better application.
Back to top
View user's profile Send private message
Braindea7
Smarty n00b


Joined: 11 May 2017
Posts: 3

PostPosted: Fri May 12, 2017 6:14 am    Post subject: Reply with quote

Wow, very helpful.
Thank you, AnrDaemon!

Is there a smart way to integrate Javascript into smarty?
Can I use variables from Javascript in Smarty?

Maybe this are smarty questions Smile

Best Regards
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 12, 2017 11:36 am    Post subject: Reply with quote

Smarty (PHP) runs on server.
JavaScript runs on client.
They never meet in person.
When one starts execution, the other is long since done and gone.
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Fri May 12, 2017 1:32 pm    Post subject: Reply with quote

Hey,

um deine rage zu beantworten: Wie AnrDaemon schon sagte ist es keine Smarty Frage, aber ich hele dir trotzdem.

Du musst es mit PHP machen und dazu kannst du z. B. die globe()-Funktion von PHP verwenden:

Code:
foreach (glob("/ordnerpfad/*.jpg") as $file) { }


damit bekommst du alle Dateien aus dem Ordner mit der Endung .jpg.

Was ich mich jedoch Frage ist, warum du das denn überhaupt als absoluten Pfad brauchst? Nur so interessehalber...
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 12, 2017 2:17 pm    Post subject: Reply with quote

If I understand OP correctly, he have files in subdirs. Something like one file per subdir.
Back to top
View user's profile Send private message
Braindea7
Smarty n00b


Joined: 11 May 2017
Posts: 3

PostPosted: Mon May 15, 2017 11:31 am    Post subject: Reply with quote

Danke Grizzly,

das hilft mir vielleicht schon einmal weiter.

Quote:
Was ich mich jedoch Frage ist, warum du das denn überhaupt als absoluten Pfad brauchst? Nur so interessehalber...

Um die Bilder auch auszugeben.
Dahinter liegt ein Shop, der die komplette Ordnerstruktur usw. eigenständig anlegt. Im Ordnerpfad ist ein Artikelmerkmal eingearbeitet. Die Bilder selber heißen wie der Artikel + eine Durchnummerierung. Es sollte eigentlich mal eine Thumbnail Vorschau entstehen, aber es gibt natürlich wieder andere Probleme, so dass das Probleme im Endeffekt wohl anders gelöst werden muss Smile

Vielen Dank trotzdem nochmal!
Grüße
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP