php code drupal database get - php

Ok I am using drupal 7.
I need to get information out of some tables so I can read them in a iPhone app. I found out I need a php code to convert a table to json format. I need the code to go to a database "x" then to table "y". Then list entity_id and name from all the fields. This will be a read only. I don't know the first thing about php code. Can anyone point me in the right direction? Thanks

Follow the steps :-
Learns PHP :-)
learn how drupal works
Learn Drupal hooks
Drupal query.
Once you are inside drupal you dont need to coonect to drupal database, its handled by Drupal.
After this you can use hook_menu and in call back function you can return required JSON output.
Use that link in your application.
Chheers!!!

Related

Bring result of PHP-Script to accepted field in TYPO3 FORM

So, it's my first question here - i found a lot of hints which all working for itself but im struggling now with the final step to get solved.
Guess it's very specific pointed to TYPO3-CMS V9 and higher.
I can also support with all of the Codes, for the moment i guess this will be better on request.
Task: Create a simple Productorderform for logged-in-users pointing just there specific products form the specific price-lists. -> solved by using PHP-Script working with a CSV-File, grabbing also some functions from TYPO3 itself to get needed parameters.
This PHP creates a DATALIST on runtime for the INPUT-Field producing the needed HTML-Code -> solved and working as expected.
Tricky part.
As TYPO3 offers a CORE-Extension called FORM and the Option to - REPEAT - the fieldset.
Also for TYPO3 there is an extension which allows to put PHP-Code directly to TYPO3 as a Content-Element.
FORM itself allows to put Content-Element to a form.
Working so far, but as described, the field (its value) is not recognized when i fire the send button.
So for some reason i have to predefine the trigger also.
I tried step for step to extend the predefined field in the php with the tags of an empty one, all(?) the surrouding DIV etc. to make FORM recognize this field as a "native" field, just extend in the main tag with ... list="prodlist" ...
Well, as you might see, i'm not a developer or programmer, i might have some skills and experiences to know where and how to go with the level (and timeframe) i have.
So i guess the final step might not be that far, but as we say here, i can't see wood because of trees...
The FORM structure by the way is saved to a YAML-file which might be also manipulated, but as i have seen, it gets the triggers -what- to parse in some way from the FORM created.
Many thanks for hints, ideas an hopefully noone was falling to sleep reading this question... ;)

How can i debug the query building my table

I'm using jQuery DataTables Editor with PHP library and I want to see the final query that is used to build my table. I looked in the following files:
Editor-PHP-1.5.6/php/Database/Driver/Mysql/Result.php
Editor-PHP-1.5.6/php/Database/Driver/Mysql/Query.php
and I saw many functions calling each other like "ping-pong" and couldn't find the way to see the final query.
I want to check my joins in the query. Where can i find it?
I appreciate this is old, and is referring to Editor 1.5, but since Editor 1.6 you can simply add ->debug(true) into the server's scripts. For more information, see the release notes for 1.6 : https://editor.datatables.net/download/1.6.0 .

Generating an image from pre-existing ones?

This is kinda confusing, so forgive me if you don't understand what I am asking. I'm trying to develop my skills and I wanted to move onto images as a next step. I did a bit of searching and I thought a good way to try this would maybe be to generate military ribbon racks depending on the options the user selects.
(See something like this as an example: http://www.ribbon-rack-builder.com/ribbons/build/4)
Now, from looking at the source code I can see that the creator of that website creates a form with all of the different ribbons and allows the user to select the ones they want with checkboxes. This form is then posted to some PHP on the page somewhere.
Being new to the image concept I have no idea what kind of PHP this would be. Could anyone give me an idea of how this website could do this and where I should start should I want to create something similar?
Thanks very much!
First, you'll need to get which checkboxes were checked:
Set the name in the form to check_list[] and you will be able to
access all the checkboxes as an array($_POST['check_list'][])
Second, you'll most likely want to use the GD and Image Functions built into PHP.
There is a lot there, and it can be confusing, so I suggest you do some reading through questions on SO on the subject: https://stackoverflow.com/search?q=merge+image+[php]

Should I be using some sort of database?

In an attempt to redesign a website, I put this page together by hand. However, there are currently over 100 more shows already that need to be added, and three new shows get added every year.
In the old system, a text document was used as a makeshift 'database'; it stored data about each show, with shows separated by '#' and data fields separated with ']'. Here's an excerpt:
#The Whorl of the Leaves]WhorlOfTheLeaves]3]F]167
#Aladdin]Aladdin]8]N]0
#A Christmas Carol]XmasCarol84-]7]N]0
#The Feral Child]FeralChild]7]N]118
#Camelot]Camelot]11]N]169
A PHP script was then used to extract the information about each show and make the page seen here.
I'm sure a script could be used to put together a page such as the one shown above, but it seems like there should be a better system than a text document to store the information.
My question is: if the text document 'database' is working, should I bother changing it? Is there a better way to organize the information about each show?
SQLite would be prefect for you. It's a tiny database that requires no configuration or setup - yet comes built into most PHP installs.
Just use PDO and your good.
$db = new PDO('sqlite:/path/to/here/mydb.sq3');
$db->query('SELECT * FROM shows');
Yep, there are a ton of "better" ways of doing this. But if you're happy with it and it works, why change it?
You could save yourself a lot of trouble by using a content management system such as drupal.

How to add interlanguages links in mediaWiki?

i have set up Wiki:Family using the tutorial #2 specified here
http://www.mediawiki.org/wiki/Wiki_family
Specifically, i am using same code, same folder, same database and different tables (they differ by prefixes) to create a multilanguage mediaWiki.
for now i have created two languages,
french and english which can be access by fr.sitename.com/wiki/ and en.sitename.com/wiki/
now i need to add interlanguage links to the article, the syntax
[[:fr:Main Page]]
does not work it just redirects me to a new page saying that i need to create the page as it does not exists while i can access it at fr.sitename.com/wiki/Main_Page
can someone please help me solve this?
Probably need to update your interwiki table - what does it contain now for iw_prefix='fr' ?. For example, see maintenance/wikipedia-interwiki.sql. Also I think there is a MediaWiki extension to do this, if you prefer a Web-based interface.

Categories