Jump to content
Stef's Coding Community

ZEND - best practice for including a custom functions folder


Recommended Posts

Hi,

 

It's my first post here.

 

I consider myself pretty IT savvy, having studied various technologies such as advanced MS Office/VBA, PHP/SQL, JS/jQuery, (X)HTML/CSS etc. I have developed websites before but I am currently in the process of learning ZEND as I am trying to build 2 small scale commercial websites and also an enterprise level website for a company I am starting. ZEND is coming to be slowly but surely, but I am also at times finding it hard to get answers to certain questions.

 

Before I start asking questions, I should state I am working with ZEND V1.12 and using NetBeans as the IDE.

 

So, here goes the first of that is sure to be many questions...

 

I am using a jQuery slider on the index page on one of the new sites I am building. The slider works by hard coding the done with the slider image URLs inside a container div. I have built a custom function that takes 2 parameters - a path to the folder containing the images, and the required file extension. As an example: -

 

<?php
function galGetTopPhotos($path, $ext) {

	//Get array of files
	$images = glob($path . "*.$ext");

	sort($images);

	//Create HTML marked array of images
	$html_string = "";

	foreach($images as $image)
	{
		$html_string .= '<img src="'.$image.'" />';
	}

	return $html_string;

}

$img_html = galGetTopPhotos('slider/images/', 'jpg');


?>

 

Edit: I accidently posted the original thread at this point without completing it. So I will complete it below...

 

Before I begin to talk about how to include a function like this in the controller, can I ask the best practice for including the custom function script itself within a ZEND application? I would assume it would reside in library/functions. Aside from that, how should it be included? In application.ini?

 

Many thanks!

 

Edit:

 

Should this be a helper class?

Edited by U4EA
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...