php snippet folder - Post ID 73038

User 13862 Photo


Registered User
6 posts

How can I create a folder in the snippets section for php code?

Thanks,
User 13862 Photo


Registered User
6 posts

OK, I still like the editor but does this mean:
1) It can't be done.
2) We are working on it.
3) I have posted this in the wrong place.

Thanks,
User 37670 Photo


Registered User
2,138 posts

It just means that this is a forum, and us volunteers don't always see every post.

Why not just use your "explorer" on the computer, navigate to your "program files" then "coffeecup" and find the "snippets" folder. Open that folder, and create a new folder called "php" or something like that. Put your code snippets for php in that folder.

Now when you use the CC Editor, in the "files" tab on the left, look for your snippets folder, select it, then open the "php" folder and you should have your snippets in there ready to use.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 13862 Photo


Registered User
6 posts

Thanks for posting, that does sound reasonable. When I tried that the "snippets" panel was blind to the new folder created inside the snippets folder.
User 37670 Photo


Registered User
2,138 posts

Mark Voyles wrote:
Thanks for posting, that does sound reasonable. When I tried that the "snippets" panel was blind to the new folder created inside the snippets folder.

Yes, the snippets folder will be blind to it, so just use the Files tab and navigate to it. Not as handy, and I have no idea why the snippets tab is being silly.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 13862 Photo


Registered User
6 posts

Maybe they could add a line in the .ini file so that a user can customize the "snippet" folder list. Do the makers read these threads?

In the mean time I think I will just empty the current contents of the snippet folder and just have php stuff in there.

Thanks very much for your assistance.

-Mark
User 157034 Photo


Ambassador
208 posts

I was about to post a new thread but then thought, "Search first!" and you have the exact same issue.

Once you collect several snippets and generate a long list, things get a bit cumbersome, so I created:

CSS Layouts
CSS Menus
CSS Misc

in the snippets folder in Prog Files/CC and exact same way as you say, the new folders can't be seen but it would make organising things a lot easier if they could. Browsing to the folders via Files isn't the same as it won't insert like a snippet.

I think that it would be a good improvement.

"Second class fairway is better than first class rough!"
User 13862 Photo


Registered User
6 posts

I agree that it would be nice to have the capability.

I have found something interesting.

Paste the following code into your editor and then save it as a .xml file in the Javascript folder inside the CC Program folder. Then close and restart CC.
Check out your Javascript Tab and you should see a php snips folder.
<ccResource>
<ccTitle>
php DB Connection Code
</ccTitle>
<ccCategory>
php Snips
</ccCategory>
<ccDescription>
Code For Connecting to MYSQL
</ccDescription>
<ccInstructions>
Insert the snippet and fill in the variable values.
</ccInstructions>
<ccHeadContent>

</ccHeadContent>
<ccBodyContent>
$dbHost = "";
$dbUser = "";
$password = "";
$dbName = "";

$link = mysql_connect($dbHost,$dbUser,$password)
or die("Problem with initial connection.");

mysql_select_db($dbName, $link)
or die("Problem with database connection.");

echo "Connected to DB <br />\n";

</ccBodyContent>
<ccElementContent>

<ccElementName></ccElementName>
<ccElementAction></ccElementAction>

</ccElementContent>
<ccExtraData>

</ccExtraData>
</ccResource>

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.