31
alain01
Re: Overload the images on the search.php page
  • 2021/10/20 14:35

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


ok ! Cool.
Here with the wrong code :

Profile module
https://www.monxoops.fr/modules/profile/userinfo.php?uid=2

Search page
https://www.monxoops.fr/search.php?query=xswatch4&action=results&lang=english

When all will be ok, I will propose my templates.



32
alain01
Re: Overload the images on the search.php page
  • 2021/10/20 13:57

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Quote:

zyspec wrote:
The file you're checking for must be a path, not a URL. So chaine_surcharge should be something like:
/var/www/html/themes/mx-theme/modules/xmnews/assets/images/xmnews_search.png

use something like XOOPS_PATH, not XOOPS_URL to build the file location.

HAAAAAaaaaaa,
ok
because I tried without "http" like "xoops-tests2.local/themes/mx-theme/modules/xmnews/assets/images/xmnews_search.png" and it didn't work.
It was URL, without http: protocol but URL.

Ok, I will check (tonight) with the path:
d/web/projets-test/xoops-tests2.local/themes/mx-theme/modules/xmnews/assets/images/xmnews_search.png

Thank you for this detail.



33
alain01
Re: Overload the images on the search.php page
  • 2021/10/20 6:16

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


yes, absolute path.
Thank you for the links .

<{assign var="chaine_surcharge" value=$xoops_imageurl|cat:"modules/"|cat:$result.image|replace:"$xoops_url/modules/":''}>
                        
chaine_surcharge : <{$chaine_surcharge}> <br />

                        <{if 
file_exists($chaine_surcharge)}>
                            <
div class="d-inline"><img src="<{$chaine_surcharge}>" alt="<{$module.name}>"> <a href="<{$result.link}>"><{$result.title}></a></div>
                            <
div class="d-none d-md-inline "><span class="fas fa-calendar fa-sm ml-2"></span> <{$result.time}></div>
                            <
br />
                        <{else}>
                            <
img src="<{$result.image}>" alt="<{$module.name}>"> <a href="<{$result.link}>"><{$result.title}></a> (<{$result.time}>)<br />
                        <{/if}>


Result:
chaine_surcharge :http://xoops-tests2.local/themes/mx-theme/modules/xmnews/assets/images/xmnews_search.png

and the test is always false so the overloaded does not work.

Quote:
In smarty, you cannot use file_exists() on a URL, but you can use it on a local file

I think, the best way is to check in your controller.

I tried

<{$file_headers = @get_headers($chaine_surcharge)}>
                        
file_headers = <{$file_headers}> <br />


but the result is :
Quote:
file_headers =



34
alain01
Re: Overload the images on the search.php page
  • 2021/10/19 21:38

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Thank you for the syntax, zyspec,
but it does not work.

<{if file_exists($chaine_surcharge)}>
                            <
div class="d-inline"><img src="<{$chaine_surcharge}>" alt="<{$module.name}>"> <a href="<{$result.link}>"><{$result.title}></a></div>
                            <
div class="d-none d-md-inline "><span class="fas fa-calendar fa-sm ml-2"></span> <{$result.time}></div>
                            <
br />
                        <{else}>
                            <
img src="<{$result.image}>" alt="<{$module.name}>"> <a href="<{$result.link}>"><{$result.title}></a> (<{$result.time}>)<br />
                        <{/if}>

The condition is always false... but the file exists

If I delete the test, the image is overloaded.



35
alain01
Re: Overload the images on the search.php page
  • 2021/10/17 21:43

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Ok, error in my code.

The code should be :
<{assign var="chaine_surcharge" value=$xoops_imageurl|cat:"modules/"|cat:$result.image|replace:"$xoops_url/modules/":''}>

result in a example :
Quote:
http://xoops-tests2.local/themes/mx-theme/modules/xmnews/assets/images/xmnews_search.png
So with that, I can overload the images...
But same trouble,
i dont know to test the existence of a file (image) with smarty.



36
alain01
Re: Overload the images on the search.php page
  • 2021/10/17 0:27

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


To understand the code :
Code :
<{assign var="chaine_start" value="$xoops_url/modules/"}>
                    
chaine_start = <{$chaine_start}> <br />
                    
                    <{
assign var="chaine_surcharge" value=$xoops_imageurl|cat:$result.image|replace:$chaine_start:''}>
                    
chaine_surcharge = <{$chaine_surcharge}> <br />


result :
Quote:



37
alain01
Re: Overload the images on the search.php page
  • 2021/10/17 0:22

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Ok,
I found a solution but I dont know How to test if a file exist in the template.

My code for the profile_userinfo.tpl overload file (http://mysite.com/themes/my_theme/modules/profile/profile_userinfo.tpl)

<li>
                    <{
assign var="chaine_start" value="$xoops_url/modules/"}>
                    <{
assign var="chaine_surcharge" value=$xoops_imageurl|cat:$result.image|replace:$chaine_start:''}>
                 
                     <{if 
$chaine_surcharge}>
                        <
img src="<{$chaine_surcharge}>" alt="<{$module.name}>"> <a href="<{$result.link}>"><{$result.title}></a> (<{$result.time}>)
                    <{else}>
                        <
img src="<{$result.image}>" alt="<{$module.name}>"> <a href="<{$result.link}>"><{$result.title}></a> (<{$result.time}>)
                    <{/if}>
               </
li>


I know that
<{if $chaine_surcharge}>
is always true but I dont find a test to test the existence of a file (image)

So the question now is :
How can I test the existence of an image with smarty in a template file ?



38
alain01
Overload the images on the search.php page
  • 2021/10/15 15:41

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Hi,
I need to change the icons on the /search.php page.

Resized Image


Basic methode :
I change on each module the file /modules/module_name/assets/images/image_search.png
BUT it's a bad method cause when i will update the module, i will erase my customize pictures

Overload method :
I add an new overloaded image in this directory:
/themes/my_theme/modules/module-1/assets/images/image_search.png
But it doesn't work

URL concerned :
1 - /search.php
2 - /modules/profile/userinfo.php?uid=x

Concrete example :
Search page: https://www.monxoops.fr/search.php?query=xswatch4&action=results
Profile page : https://www.monxoops.fr/modules/profile/userinfo.php?uid=3

I want to change this image : [img ]https://www.monxoops.fr/modules/xmnews/assets/images/xmnews_search.png[/img]
to
[img ]https://www.monxoops.fr//themes/mx-theme/modules/xmnews/assets/images/xmnews_search.png[/img] (just an example to view the change)

Any good solution ?



39
alain01
Re: My Latest Xoops Project
  • 2021/10/8 16:39

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Yes, goob job and nice design.

I 've just noticed a strange thing :

On thehttps://www.invitahome.com/modules/publisher/item.php?itemid=27 link,
You can view xoops images then , it would be override by the good images.

It is alternative image I think
https://www.invitahome.com/modules/publisher/assets/images/default_image.jpg

<a data-lightbox="image-1" data-title="Gallery" href="https://www.invitahome.com/uploads/images/img615fd7bfe4885.jpg">
                                <
img class="img-responsive" alt="" src="https://www.invitahome.com/modules/publisher/assets/images/default_image.jpg" data-echo="https://www.invitahome.com/uploads/images/img615fd7bfe4885.jpg" />
                            </
a>



40
alain01
Re: Most current Xoops 2.5.11
  • 2021/10/4 22:27

  • alain01

  • Just can't stay away

  • Posts: 528

  • Since: 2003/6/20


Hi,
Nice news !
you can show your own repository first. (Github URl).

I have my own repository but I need to continue my efforts.
We've just merged some new features in the core here.

Maybe Mamba could propose another solution, let's see what he says!




TopTop
« 1 2 3 (4) 5 6 7 ... 38 »



Login

Who's Online

170 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 170


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits