How to Include file1 into another file in magento - file

I have 2 files in Catalog folder of my template. I want to include one file into another file I tried simple php "require('html2fpdf.php');" method but it does not works. Please let me know how can I include this file into other file.

In Magento you use getChildHtml to include blocks.
Magento work with layout and block concept.
So you need to create a block using some xml and block class file.Also you need to make sure your block is in proper layout handle.

Related

Where do i put mdl files for function SetModel

I am new in lua and gmod coding. I have already coded successfully a HUD's addons but i am stuck in another.
I want to create a new entity, and after reading lots of tutorial, i manage to do it but in game, the word ERROR appears in red when spawning, not the model. The server and the client are located on the same PC, for debugging considerations. I try to put mdl files on several folders without aby change.
I put mdl file in
addons/models/model.mdl
I think the client doesn't find the model file : do i need a workshop content even for testing ? Where do i put the files ?
Thanks.
I got it. When reusing existing MDL file, i must keep the original path for files.
That is, when opening mdl file, a path is writing at the begining. This path must be the same in the models subfolder of the addons (path and filename).

Handling filetypes that contain multiple files?

Some filetypes in Visual Studio includes more then one file, for example resx and winform files. So If I need to add existing filetyp of this type I always end upp with multiple files in solution explorer? Are thay not supose to be shown as one file based on there name?
BestRegards
So If I need to add existing filetyp of this type I always end upp
with multiple files in solution explorer?
Multiple file is the part of ProjectItem template. If you add WinFor you will always get several files.
If you don't want to use such template you can create your own template from code created ones with File->Export Template wizard.
To group files in solution explorer read this post

For proper CakePHP conventions, how would I go about storing pieces of a script file that I would put together in execution?

I'm working on a little project in which CakePHP will be outputting script which will be interpreted by another client.
Thus far I have a layout setup which properly displays the script and only the script. I simply set it into an array, which each new line as a new row in the array. The view then just rolls through a foreach to display them, no problem. This is working perfectly.
Now what I would like to do is have cake slice and dice different pre-made script portions together. Basically I would store 'methods' as individual files of some kind, which can then be called by cakephp as needed and put together to make a single script.
What I'm wondering is:
a. If I'm following the cake conventions, where and how should these text files be stored?
b. What's the easiest way to call these files and set them into an array?
Thanks so much!
a.
I woud create a folder named Scripts/ in the app/View/Elements/ folder.
For each individual script, create a file in that folder. E.g. somefunction.ctp.
Those scripts can than be printed by calling echo $this->element('Scripts/somefunction'); (omit the '.ctp' extention)
b.
Putting the content of these files in an array could go like this:
array_push( code_array, $this->element('Scripts/somefunction') );

How do I delete a file?

I need to delete a picture from a folder where pictures are stored. For example, a file in the C:\Milk\Pictures folder. How do I do this?
Using the SysUtils function DeleteFile:
if DeleteFile(FileName) then
// File deleted;
SysUtils is usually included by default. In XE2, if you have to add it you may have to use System.SysUtils because of new namespace rules.

Difficulty with filename and filemime when using Migrate module

I am using the Drupal 7 Migrate module to create a series of nodes from JPG and EPS files. I can get them to import just fine. But I notice that when I am done importing them if I look at the nodes it creates, none of the attached filefield and thumbnail files contain filename information.
Upon inspecting the file_managed table I see that both the filename and filemime fields are empty for ONLY the files that I attached via the migrate module. This also creates an issue with downloading the files.
Now I think the problem has to do with the fact that I am using "file_link" instead of "file_copy" as the file operation I specify. The problem is I am importing around 2TB (thats Terabytes) of image files. We had to put in a special request with Rackspace just to get access to that much disk space on our server. So I can't go around copying from one directory to the next because of space issues. So "file_link" seems like the obvious choice.
Now you probably want to see how I am doing this exactly, so here is the code snippet:
$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' => 'jpg_name'),
array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));
$this->addFieldMapping('field_image', 'jpg_uri')
->arguments($jpg_arguments);
As you can see I am specifying no base path (just like the beer.inc example file does). I have set file_link, the language, and the source fields for the description, title, and alt.
It is able to generate thumbnails from the JPGs. But still missing those columns of data in the db table. I traced through the functions the best I could but I don't see what is causing this. I tried running the uri in the table through the functions that generate the filename and the filemime and they output just fine. It is like something is removing just those segments of data.
Does anyone have any idea what this could be? I am using the Drupal 7 Migrate module version 2.2. It is running on Drupal 7.8.
Thanks,
Patrick
Ok, so I have found the answer to yet another question of mine. This is actually an issue with the migrate module itself. The issue is documented here. I will be repealing this bounty (as soon as I figure out how).

Resources