Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z zmienną PHP
alkesz1718
post
Post #1





Grupa: Zarejestrowani
Postów: 98
Pomógł: 0
Dołączył: 8.12.2014
Skąd: Czernina

Ostrzeżenie: (0%)
-----


Witam, od jakiegoś czasu pracuję nad pewnym projektem strony muzycznej gdzie player dodawany jest z bbcode np:
  1. [hl=http://hu.lk/m1sq63fee6f4]


w swoim oprogramowaniu strony gdzie ten tag zmienia na player mam coś takiego:

  1. /* Hulkshare Player */
  2. function build_hulk( $matches=array() ) {
  3. global $config;
  4. $hurl = $matches[1];
  5.  
  6. if( $hurl == "" ) return;
  7. if( preg_match( "/[?&;%<\[\]]/", $hurl ) ) {
  8. return "[hl=" . $hurl . "]";
  9. }
  10. $hurl = $this->clear_url( $hurl );
  11. return "
  12.  
  13. <iframe id=\"hulkshare-player-embed\" name=\"hulkshare-player-embed\"
  14. src=\"http://www.hulkshare.com/hsPlayer/embed/embed_clean.php?fn=$hulk
  15. &enableDownload=0&enableCover=0&enableAdd=false&bg=undefined&fg=undefined&iconColor=undefined&backColor=undefined&outColor=undefined&overColor=undefined&
  16. textColor=undefined&tintColor=undefined&pid=&type=7&width=100%\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"width:100%;height:160px;\">
  17. </iframe>
  18. ";}
  19. /* End HulkShare Player */


Gdzie
  1. $hurl
to jest to co jest dodawane w tagu bbcode

Teraz chcę zrobić coś takiego:



Czyli chcę w tym moim kodzie z linku wyciągnąć tą część która jest potrzebna do kodu Iframe (w inny sposób nie zadziała player)

Byłbym bardzo wdzięczny gdyby ktoś do tego kodu dopisał zmienną na to. Ja niestety zaczynam prace z PHP i nie do końca umiem te wszyskie zmienne tworzyć
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
markuz
post
Post #2





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

Ostrzeżenie: (0%)
-----


  1. $url = 'http://hu.lk/er40pctcmyv4';
  2. $id = end(explode('/', $url));


Ten post edytował markuz 8.12.2014, 21:58:46


--------------------
Go to the top of the page
+Quote Post
alkesz1718
post
Post #3





Grupa: Zarejestrowani
Postów: 98
Pomógł: 0
Dołączył: 8.12.2014
Skąd: Czernina

Ostrzeżenie: (0%)
-----


Chyba nie do końca ja rozumiem o co w tym chodzi...

ja chcę by do tego kodu:
  1. /* Hulkshare Player */
  2. function build_hulk( $matches=array() ) {
  3. global $config;
  4. $hurl = $matches[1];
  5.  
  6. if( $hurl == "" ) return;
  7. if( preg_match( "/[?&;%<\[\]]/", $hurl ) ) {
  8. return "[hl=" . $hurl . "]";
  9. }
  10. $hurl = $this->clear_url( $hurl );
  11. return "
  12.  
  13. <iframe id=\"hulkshare-player-embed\" name=\"hulkshare-player-embed\"
  14. src=\"http://www.hulkshare.com/hsPlayer/embed/embed_clean.php?fn=$hulk
  15. &enableDownload=0&enableCover=0&enableAdd=false&bg=undefined&fg=undefined&iconColor=undefined&backColor=undefined&outColor=undefined&overColor=undefined&
  16. textColor=undefined&tintColor=undefined&pid=&type=7&width=100%\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"width:100%;height:160px;\">
  17. </iframe>
  18. ";}
  19. /* End HulkShare Player */
  20.  
  21.  


Dopisać w odpowiednim miejscu zmienną która ma takie działanie jak podałem na obrazku
Go to the top of the page
+Quote Post
markuz
post
Post #4





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

Ostrzeżenie: (0%)
-----


Podałem rozwiązanie twojego problemu. Pogłówkuj trochę w przeciwnym wypadku zapraszam do tego działu. smile.gif


--------------------
Go to the top of the page
+Quote Post
alkesz1718
post
Post #5





Grupa: Zarejestrowani
Postów: 98
Pomógł: 0
Dołączył: 8.12.2014
Skąd: Czernina

Ostrzeżenie: (0%)
-----


  1. /* Hulkshare Player */
  2. function build_hulk( $matches=array() ) {
  3. global $config;
  4.  
  5. $hurl = $matches[1];
  6. if( $hurl == "" ) return;
  7. if( preg_match( "/[?&;%<\[\]]/", $hurl ) ) {
  8. return "[hl=" . $hurl . "]";
  9. }
  10. $hurl = $this->clear_url( $hurl );
  11. $hulk = end(explode('/', $hurl));
  12.  
  13. return "
  14.  
  15. <iframe id=\"hulkshare-player-embed\" name=\"hulkshare-player-embed\"
  16. src=\"http://www.hulkshare.com/hsPlayer/embed/embed_clean.php?fn=$hulk
  17. &enableDownload=0&enableCover=0&enableAdd=false&bg=undefined&fg=undefined&iconColor=undefined&backColor=undefined&outColor=undefined&overColor=undefined&
  18. textColor=undefined&tintColor=undefined&pid=&type=7&width=100%\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"width:100%;height:160px;\">
  19. </iframe>
  20. ";}
  21. /* End HulkShare Player */


Powiedzmy że działa ale ta zmienna od ciebie powoduje mi błąd w skrypcie podczas edytowania artykułu:
Strict Standards: Only variables should be passed by reference in /usr/home/user/domains/site.pl/public_html/engine/classes/parse.class.php on line 1222
Strict Standards: Only variables should be passed by reference in /usr/home/user/domains/site.pl/public_html/engine/classes/parse.class.php on line 1222


ale z tym chyba się już udam do supportu silnika może będą wiedzieć w czym tkwi błąd
Go to the top of the page
+Quote Post
daniel1302
post
Post #6





Grupa: Zarejestrowani
Postów: 602
Pomógł: 30
Dołączył: 1.08.2007
Skąd: Nowy Sącz

Ostrzeżenie: (0%)
-----


Błąd jest w twojej funkcji, próbujesz przekazać przez referencje coś co nie jest zmienną np wynik prosto z funkcji.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 20:34