PHP Woes with font display - php

I'm building a two column content section on my website that allows a user to select an example of a font, enter a string of text, and click a button in the right column and in the left display the selected font and text the user has chosen.
I have looked at the PHP website and don't even know where to start. I'm used to dealing with databases and forms in PHP for gathering data but have never attempted something like this before.
I feel like it should be pretty simple so any help or hints are appreciated.
I would like to use fonts from: http://www.tattoo-fonts.com

Related

What approach to a post based (like a blog) webpage, with separate page to allow users to add a post

I'm currently trying to develop my own website from scratch as I try and teach myself more about web development. I'd like to work out how to have a section on my website that displays blog posts I write, but without having to edit the HTML each time I write a post. I'd like a separate page where someone can write a blog, then when they press submit, it will add it to the website.
I've had a nose about online and a think about it. I'm guessing this is like a content management system, but I'm unsure if this is something I should try and manually code myself or if there's common practice out there for this sort of thing.
My thoughts on how to tackle the problem would be as follows. I'm guessing blog posts will need to be stored in a database. On the page that displays blog posts, it won't contain hard coding of any blog posts, but instead they will be pulled from a database and displayed. So you'd need to write code that will extract records from a database and display the heading / content as you desire, with a separator between posts. And you limit maybe to fetching X amount of posts from the database at a time. Then with regards to the writing of posts, I'd need to make a webpage that you log in to, and write a blog post as if it was a form and submit it to the database via Php or something? I appreciate this may not included a fancy text editor while writing a blog post, mind.
I'm sorry if this isn't the right type of question for stackoverflow. I know I've not presented code for you to help with, but it is about how these things are coded - so I don't start working on something redundant. Thanks for reading.
(FYI: My experiences so far are creating a website that uses HTML, CSS and a small amount of Javascript, using PHP and MYSQL. I've created a log in system, and allowed users to add, edit and delete records via forms. I've displayed information from databases in forms and tables.)
Store everything in database.
Simple way (you can make it complicated later),
table structure:
MainTable
text_id(Primary Key),
used_id(Foreign Key),
approved(allowed to be displayed),
text(text body)
User(You) with access to admin panel.
Admin Panel page to approve texts to be displayed.
select * from MainTable WHERE approved = 0
You have all unapproved texts.
UPDATE MainTable SET approved = 1 WHERE text_id = /this text id/
Now it can be displayed.
Page where you want display texts.
You would have to identify user with user_id to get his texts.
SELECT * from MainTable WHERE user_id = /this user id/ and apporoved = 1
display texts.

How to scrape my own site? (php/wordpress plugin)

I am trying to make a table on my website display images and text based on the data of another hidden table that is easily pasted into the website.
I feel like this should be pretty simple but I do not know where to begin looking. I dont know if this is similar to scraping another site or if there is a wordpress plugin where I can make a certain input display certain things in a table.
Thanks
EDIT - Forget scraping, I just want to display something based on something I paste in that is hidden.
I have a stylized table and a table that with the data that will be pasted in. I want the data in the pasted in table to show in the stylized table, but if the data is, for example "123", I don't want it to display "123" but a certain image instead.

Moodle - CkEditor is not coming for dynamically created courses

I am new to Moodle, I have been developing a learning management system from past couple of weeks, which includes direct tweaks in the core code of moodle.
I have set of courses which has to be created from the backend of MySQL. When I am trying to create a course from MySQL (Not Website), then while editing the course, ckeditor doesn't come. It is a plain TextArea with an additional dropdown.
I am not able to understand, why is it coming like that? I have populated all proper data in the table. Is there something else which has to be done apart from just populating summary field in mdl_course table.?
Thank you.
First ... is the "text editor" option in your profile correctly set to atto or ckeditor?
Then, I wonder which field or page on which you want to see an html text editor show up. I'm thinking you are looking at the "summary" field. If so, make sure the "summaryformat" column is set to 1. While 0 is for "Moodle format", 1 stands for "HTML format".
Hopefully, this helps!
Sometimes it caused by 'old cache', try full refresh browser, [Shift]-F5.
Or clean you browser cache.
If you use firefox (I use firefox version 33) : Menu (hamburger icon on top right) > Preferences > Advance > Network > Clear now (Cache web content)

Making screenshot of the website with changes made by user

Is it possible to take a screenshot of the visible part of the website directly as it is seen by user (rendered by by the browser), including any changes made by user (e.g. moved divs, text typed in forms etc.)?
So you open a website, where you can make changes to its content. And there's a button (on the website of course), when you click it, the actual visible part of the website with all the changes you made is saved as an image and for example there goes a popup window where you can type in an email to send this image to, or something like that. Javascript, php, html5 or anything else? Old browsers and ie doesn't matter.
I've searched a lot for the answer, read lots of related articles, but I couldn't find the solution, cause what I need is not the script that would re-render the page like html2canvas, but capture the actual content displayed on the screen.
Any ideas and comments are much appreciated!
This is something that can be extremely tricky.
Essentially your only option of doing this in browser with no extensions or such is to try rendering HTML into the <canvas> tag.
There are several projects which do that, most reliable choices are noted in this SO question's answers: Render HTML in Canvas/WebGL
Note that none of the projects are 100% accurate, but a canvas can be rendered into an image and thus could be saved or emailed by the user like you asked.

Drupal - adding square ads to the body of articles

I need to insert a google adsense square box in the middle of all articles on the site.
What is the best approach?
The site is in drupal, so I figures I can hook to the view node function. this way the ad won't be saved together with the article. does that make sense? If so, than the question is how do I ensure I won't have image on the other side of the ad (the ad is aligned to the left and should take 50% of the article width)?
should I be using a block? but how will I know to place the block in inside the block.
So in short, I really have no idea where to start to implement it... How is this thing implemented in all the news sites?
I'd approach it by implementing a custom input filter that would insert the AdSense code (or the AdSense module shortcode, if you want) into the processed text. Once you have that custom filter implemented, you'll have to enable it in the text format you're using for the content type.
For implementing a custom filter, take a look at filter_example here.
This solution is for Drupal 7. The solution which worked for me is that I used the adsense tags format and then used this format to show ads on the site. Note that this line doesnot need any js inclusion or script tags. You just need to enable the Adsense tags format(I mean shortcode). Actually I was getting Ads disabled for admin and for other users i was getting the empty ad with space occupied on page but nothing shown. After different tweaks and experiments I got the following code working for me
[adsense:336x280:XXXXXXXXXX]
2nd parameter is width x height
3rd parameter: XXXXXXXXXX denotes the google ad slot/id.
I hope this will help others.
Ata ul Mustafa
I need to insert a google adsense square box in the middle of all articles on the site. What is the best approach?
From my experience:
On some drupal sites I used simply node editor to put box with adsense into content. For websites with not many nodes its best solution because of:
1) Box perfect fits in rest of content - you can change it manually.
2) Total control of viewed boxes - images, flash, text adds etc.
Etc.
But for websites with many nodes, this solution looks like stupid suicide.
Better option will be change node.tpl file in your theme folder. But there is some trouble. In this file, you have $content variable, with contains all of content in this node. This situation gives you ability to put box up or down of this node. But no in the middle. Perhaps solution will be to divide $content into 2x variables which will contains a half of contents. But question is - how do to it? Or maybe while content from node is saved into database, then you can put some html code with adsense box? And search best position to put box by regular expressions? Or maybe change all of nodes by adding html box directly in database?
should I be using a block? but how will I know to place the block in
inside the block.
As I remember, you cannot put block inside another block.

Categories