17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 8174 Views |
-
Re: silverstriping a site with random pictures

16 August 2008 at 3:29am Last edited: 16 August 2008 3:31am
I have insert the function in the File AssetAdmin.php these is in the folder cms\code.
And now in the SideBar.ss under the sidebarBottom ihave insert
<div><% include $RandomImage(gallery) %> ???? it is notthanks
---Stooni
-
Re: silverstriping a site with random pictures

18 August 2008 at 8:11pm
How to write the control please help!
these way? <% control RandomImage(gallery) %>
Thanks for Help!
---Stooni
-
Re: silverstriping a site with random pictures

18 August 2008 at 8:49pm
The example RandomImage() Method returns the filename of the image , so in the template you can probably call the method immediately (without a control) , to get a filename :
e.g. <img src="$RandomImage(mydirectory)" />
-
Re: silverstriping a site with random pictures

18 August 2008 at 10:02pm
I give these in the file
<img src="$RandomImage(assets/gallery)" alt="$Title photo" />
an i become this in the code,
<img src="" alt="About Us photo" /></p>
I think the function can not be found.
--Thanks
Stooni -
Re: silverstriping a site with random pictures

19 August 2008 at 12:13am
make sure your function can be reached (put it in your base - page class to test)....
-
Re: silverstriping a site with random pictures

19 August 2008 at 9:45pm
I have inserted theses
function RandomImage( $strLeftDirName )
{
if ( !is_string( $strLeftDirName ) )
{
return false;
}
$left_dir = DataObject::get_one("Folder", "Name = \"$strLeftDirName\"");
$randImg = ( $left_dir->ID ) ? DataObject::get_one("Image", "ParentID = $left_dir->ID", true, "RAND()" ) : false;
return $randImg->Filename;
}in the function class Page_Controller extends ContentController in the site mysite\code\Page.php and i becoming these Errors.
Notice: Trying to get property of non-object in C:\xampp\htdocs\ss099\mysite\code\Page.php on line 25Notice: Trying to get property of non-object in C:\xampp\htdocs\ss099\mysite\code\Page.php on line 26
Thanks
--Stooni
-
Re: silverstriping a site with random pictures

20 August 2008 at 12:25am
Is the error being thrown on this line ?
$randImg = ( $left_dir->ID ) ? DataObject::get_one("Image", "ParentID = $left_dir->ID", true, "RAND()" ) : false;
Then check if SS finds your directory correctly....
-
Re: silverstriping a site with random pictures

20 August 2008 at 6:18am Last edited: 20 August 2008 6:18am
Thanks its going!!! yuupie!
Now I only need to get the small Tumbnails be displayed.!
with these command <img src="$RandomImage(gallery)" alt="$Title photo" />
I hope I get to do otherwise I am back in the forum.Thank you very much!
---Stooni
| 8174 Views | ||
| Go to Top | Next > |

